From: Arjen J.W. P. <po...@us...> - 2008-10-14 11:56:24
|
Update of /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20404/samples/petclinic/src/org/springframework/samples/petclinic/web Modified Files: AddVisitForm.java AddPetForm.java EditOwnerForm.java EditPetForm.java AddOwnerForm.java FindOwnersForm.java Log Message: SPR-4999 Index: AddPetForm.java =================================================================== RCS file: /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web/AddPetForm.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** AddPetForm.java 2 Dec 2007 00:40:52 -0000 1.18 --- AddPetForm.java 14 Oct 2008 11:56:16 -0000 1.19 *************** *** 17,21 **** --- 17,23 ---- import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; + import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.SessionStatus; + import org.springframework.web.bind.WebDataBinder; /** *************** *** 43,47 **** } ! @RequestMapping(method = RequestMethod.GET) public String setupForm(@RequestParam("ownerId") int ownerId, Model model) { Owner owner = this.clinic.loadOwner(ownerId); --- 45,54 ---- } ! @InitBinder ! public void setAllowedFields(WebDataBinder dataBinder) { ! dataBinder.setDisallowedFields(new String[] {"id"}); ! } ! ! @RequestMapping(method = RequestMethod.GET) public String setupForm(@RequestParam("ownerId") int ownerId, Model model) { Owner owner = this.clinic.loadOwner(ownerId); Index: FindOwnersForm.java =================================================================== RCS file: /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web/FindOwnersForm.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** FindOwnersForm.java 2 Dec 2007 00:40:52 -0000 1.17 --- FindOwnersForm.java 14 Oct 2008 11:56:16 -0000 1.18 *************** *** 11,14 **** --- 11,16 ---- import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; + import org.springframework.web.bind.annotation.InitBinder; + import org.springframework.web.bind.WebDataBinder; /** *************** *** 30,33 **** --- 32,40 ---- } + @InitBinder + public void setAllowedFields(WebDataBinder dataBinder) { + dataBinder.setDisallowedFields(new String[] {"id"}); + } + @RequestMapping(method = RequestMethod.GET) public String setupForm(Model model) { Index: EditPetForm.java =================================================================== RCS file: /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web/EditPetForm.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** EditPetForm.java 2 Dec 2007 00:40:52 -0000 1.17 --- EditPetForm.java 14 Oct 2008 11:56:16 -0000 1.18 *************** *** 16,20 **** --- 16,22 ---- import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; + import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.SessionStatus; + import org.springframework.web.bind.WebDataBinder; /** *************** *** 41,44 **** --- 43,51 ---- } + @InitBinder + public void setAllowedFields(WebDataBinder dataBinder) { + dataBinder.setDisallowedFields(new String[] {"id"}); + } + @RequestMapping(method = RequestMethod.GET) public String setupForm(@RequestParam("petId") int petId, Model model) { Index: EditOwnerForm.java =================================================================== RCS file: /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web/EditOwnerForm.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** EditOwnerForm.java 2 Dec 2007 00:40:52 -0000 1.14 --- EditOwnerForm.java 14 Oct 2008 11:56:16 -0000 1.15 *************** *** 13,17 **** --- 13,19 ---- import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; + import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.SessionStatus; + import org.springframework.web.bind.WebDataBinder; /** *************** *** 33,36 **** --- 35,43 ---- } + @InitBinder + public void setAllowedFields(WebDataBinder dataBinder) { + dataBinder.setDisallowedFields(new String[] {"id"}); + } + @RequestMapping(method = RequestMethod.GET) public String setupForm(@RequestParam("ownerId") int ownerId, Model model) { Index: AddVisitForm.java =================================================================== RCS file: /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web/AddVisitForm.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AddVisitForm.java 2 Dec 2007 00:40:52 -0000 1.16 --- AddVisitForm.java 14 Oct 2008 11:56:16 -0000 1.17 *************** *** 14,18 **** --- 14,20 ---- import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; + import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.SessionStatus; + import org.springframework.web.bind.WebDataBinder; /** *************** *** 35,38 **** --- 37,45 ---- } + @InitBinder + public void setAllowedFields(WebDataBinder dataBinder) { + dataBinder.setDisallowedFields(new String[] {"id"}); + } + @RequestMapping(method = RequestMethod.GET) public String setupForm(@RequestParam("petId") int petId, Model model) { Index: AddOwnerForm.java =================================================================== RCS file: /cvsroot/springframework/spring/samples/petclinic/src/org/springframework/samples/petclinic/web/AddOwnerForm.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AddOwnerForm.java 2 Dec 2007 00:40:52 -0000 1.17 --- AddOwnerForm.java 14 Oct 2008 11:56:16 -0000 1.18 *************** *** 12,16 **** --- 12,18 ---- import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.SessionAttributes; + import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.SessionStatus; + import org.springframework.web.bind.WebDataBinder; /** *************** *** 33,37 **** } ! @RequestMapping(method = RequestMethod.GET) public String setupForm(Model model) { Owner owner = new Owner(); --- 35,44 ---- } ! @InitBinder ! public void setAllowedFields(WebDataBinder dataBinder) { ! dataBinder.setDisallowedFields(new String[] {"id"}); ! } ! ! @RequestMapping(method = RequestMethod.GET) public String setupForm(Model model) { Owner owner = new Owner(); |