Sometimes we need to update the domain object partially. We get complete object from database but we have to update some fields of it using html form. In this situation, original Data Object is kept on the server and some fields are asked to be filled by user. In Sprint MVC, we have implemented feature that helps us to get it done. There is @ModelAttribute annotation that captures Bean object at server and maps its values to submitted form's fields. In following code, pupulateContact() method annotated with @ModelAttribute annotation. This make sure that this method is called before any @RequestMapping annotated method like open() and save() in this code. pupulateContact() method returns an object having some fields initialized. We want to get other fields from HTML form. After submission ,Contact Object will have all values in it. It remembers the initialized value and get updated with new values those are sent in request. Other will remain as it is. package pack; ...
Future driven solutions.