我对这个代码的问题,请帮助我,我有豆的名字“命令”可以作为请求属性这样 无论BindingResult一个错误也不是普通的目标对象Spring MVC中registraton一些程序错误
controllercode:
public class RegistrationController {
@RequestMapping(value="/reg" ,method = RequestMethod.POST)
public String reg(@ModelAttribute("aaa") User user,ModelMap model,BindingResult res){
model.addAttribute("Fname",user.getFname());
System.out.println(user.getFname());
model.addAttribute("Lname", user.getLname());
model.addAttribute("Email", user.getEmail());
model.addAttribute("Pwd", user.getPwd());
model.addAttribute("Phnum", user.getPhnum());
return "NewFile";
}
}
<form:form method="POST" action="/reg" name="aaa">
<table>
<tr>
<td width="127"><form:label path="Fname">Employee Id:</form:label></td>
<td width="102"><form:input path="Fname" /></td>
</tr>
<tr>
<td width="127"><form:label path="Lname">Employee Id:</form:label></td>
<td width="102"><form:input path="Lname" /></td>
</tr>
<tr>
<td width="127"><form:label path="Email">Employee Id:</form:label></td>
<td width="102"><form:input path="Email" /></td>
</tr>
<tr>
<td width="127"><form:label path="Pwd">Employee Id:</form:label></td>
<td width="102"><form:input path="Pwd" /></td>
</tr>
<tr>
<td width="127"><form:label path="Phnum">Employee Id:</form:label></td>
<td width="102"><form:input path="Phnum" /></td>
</tr>
</table>