2011-09-26 59 views
1

在Spring 2.5中;有SimpleFormController的方法具有Spring MVC 3 SimpleFormController

@Override 
     protected Object formBackingObject(HttpServletRequest request) throws Exception { 
      //logic for command object 

} 

什么是它在Spring MVC 3替代我想加载命令对象在JSP页面的形式。

回答

3

使用@ModelAttribute

@ModelAttribute 
public MyFormObject createForm(HttpServletRequest request){ 

} 

如果没有这一要求也

@ModelAttribute 
public MyFormObject createForm(){ 

} 
工作