Currently, I would like to expand my knowledge in Spring MVC, so I am studying examples of web applications that are in the Spring distribution. I mostly check out the Petclinic app.
In the GET method, a Pet object was added to the model attributes so that the JSP can access the javabean properties. I seem to understand that.
@Controller
@RequestMapping("/addPet.do")
@SessionAttributes("pet")
public class AddPetForm {
@RequestMapping(method = RequestMethod.GET)
public String setupForm(@RequestParam("ownerId") int ownerId, Model model) {
Owner owner = this.clinic.loadOwner(ownerId);
Pet pet = new Pet();
owner.addPet(pet);
model.addAttribute("pet", pet);
return "petForm";
}
@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result);
if (result.hasErrors()) {
return "petForm";
}
else {
this.clinic.storePet(pet);
status.setComplete();
return "redirect:owner.do?ownerId=" + pet.getOwner().getId();
}
}
}
But what I cannot understand is during the POST operation. I look at my firebug and I notice that my message data is only the data that was entered by the user, which is fine for me.

But when I check the data on my controller. Owner information is still complete. I look at the generated HTML from the JSP, but I do not see the hidden information about the Owner object. I'm not sure where Spring collects information about the owner object.
, Spring ?

Spring MVC 2.5.