Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form:form name="form" action="/myAction" method="POST" commandName="model1">
- <form:input path="property"/>
- ....
- <input type="submit" value="Submit"/>
- </form:form>
- @SessionAttributes("model2")
- class Controller {
- @RequestMapping(value = "/myAction", method = POST)
- public String submitEditSite(final @ModelAttribute(value = "model1") Model1 model1,
- final @ModelAttribute(value = "model2") Model2 model2) {
- ....
- return "redirect:/home";
- }
- }
- class Model1 {
- private String property;
- }
- class Model2 {
- private String property;
- }
- @InitBinder("model2")
- public void initBinder(WebDataBinder binder) {
- binder.setDisallowedFields("*");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement