mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-04-25 03:42:48 +00:00
Fix #207 set pet owner when for has an error
This commit is contained in:
parent
ca2a66500f
commit
61be1bac41
1 changed files with 1 additions and 0 deletions
|
@ -103,6 +103,7 @@ class PetController {
|
||||||
@RequestMapping(value = "/pets/{petId}/edit", method = RequestMethod.POST)
|
@RequestMapping(value = "/pets/{petId}/edit", method = RequestMethod.POST)
|
||||||
public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model) {
|
public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model) {
|
||||||
if (result.hasErrors()) {
|
if (result.hasErrors()) {
|
||||||
|
pet.setOwner(owner);
|
||||||
model.put("pet", pet);
|
model.put("pet", pet);
|
||||||
return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
|
return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue