52535455565758
* For every request for this controller, this will * create a person instance for the form. */ @ModelAttribute public Person newRequest(@RequestParam(required=false) Integer id) { return (id != null ? repository.findOne(id) : new Person()); }
7475767778798081828384
public Person form(Person person, Model model) { if (person.getCreated() == null) { person.setCreated(new Date()); } Person result = repository.saveAndFlush(person); model.addAttribute("statusMessageKey", "person.form.msg.success"); return result; }