Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <form:form name="form" action="/myAction" method="POST" commandName="model1">
  2. <form:input path="property"/>
  3. ....
  4. <input type="submit" value="Submit"/>
  5. </form:form>
  6.  
  7. @SessionAttributes("model2")
  8. class Controller {
  9. @RequestMapping(value = "/myAction", method = POST)
  10. public String submitEditSite(final @ModelAttribute(value = "model1") Model1 model1,
  11. final @ModelAttribute(value = "model2") Model2 model2) {
  12. ....
  13. return "redirect:/home";
  14. }
  15. }
  16.  
  17. class Model1 {
  18. private String property;
  19. }
  20. class Model2 {
  21. private String property;
  22. }
  23.  
  24. @InitBinder("model2")
  25. public void initBinder(WebDataBinder binder) {
  26. binder.setDisallowedFields("*");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement