mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:15:49 +00:00
commit
a271315c53
1 changed files with 3 additions and 2 deletions
|
@ -84,12 +84,13 @@ class OwnerController {
|
||||||
@GetMapping("/owners")
|
@GetMapping("/owners")
|
||||||
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
|
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
|
||||||
|
|
||||||
System.out.println("***" + owner.getLastName());
|
|
||||||
// allow parameterless GET request for /owners to return all records
|
// allow parameterless GET request for /owners to return all records
|
||||||
if (owner.getLastName() == null) {
|
if (owner.getLastName() == null) {
|
||||||
owner.setLastName(""); // empty string signifies broadest possible search
|
owner.setLastName(""); // empty string signifies broadest possible search
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("Searching for " + owner.getLastName().trim());
|
||||||
|
|
||||||
// find owners by last name
|
// find owners by last name
|
||||||
Collection<Owner> results = this.owners.findByLastName(owner.getLastName());
|
Collection<Owner> results = this.owners.findByLastName(owner.getLastName());
|
||||||
if (results.isEmpty()) {
|
if (results.isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue