A.//连接到add页面,会进入下面的方法
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(@ModelAttribute("addUser") User addUser){
return "user/add";
}
add.jsp页面关键代码截取:
<fm:form modelAttribute="addUser" method="post" action="addSave">
id:<fm:input path="id"/> <br/>
userName:<fm:input path="userName"/><br/>
password:<fm:input path="password"/><br/>
email:<fm:input path="email"/><br/>
<input type="submit" value="提交"/>
</fm:form>
B.//连接到add页面,会进入下面的方法
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(User addUser){
return "user/add";
}
add.jsp页面关键代码截取:
<fm:form modelAttribute="addUser" method="post" action="addSave">
id:<fm:input path="id"/> <br/>
userName:<fm:input path="userName"/><br/>
password:<fm:input path="password"/><br/>
email:<fm:input path="email"/><br/>
<input type="submit" value="提交"/>
</fm:form>
C.//连接到add页面,会进入下面的方法
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(Model model){
model. addAttribute(new User())
return "user/add";
}
add.jsp页面关键代码截取:
<fm:form modelAttribute="user" method="post" action="addSave">
id:<fm:input path="id"/> <br/>
userName:<fm:input path="userName"/><br/>
password:<fm:input path="password"/><br/>
email:<fm:input path="email"/><br/>
<input type="submit" value="提交"/>
</fm:form>
D.//连接到add页面,会进入下面的方法
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(User user){
return "user/add";
}
add.jsp页面关键代码截取:
<fm:form modelAttribute="user" method="post" action="addSave">
id:<fm:input path="id"/> <br/>
userName:<fm:input path="userName"/><br/>
password:<fm:input path="password"/><br/>
email:<fm:input path="email"/><br/>
<input type="submit" value="提交"/>
</fm:form>