你好我正在运行的Spring MVC应用程序,但由于java.lang.IllegalStateException我java.lang.IllegalStateException Spring MVC的
无法运行。
这里是异常
java.lang.IllegalStateException:无论BindingResult也不是为bean名称“unixModel11”可以作为请求属性
供您参考类和JSP页面平原目标对象
控制器:
@Controller
公共类TroubleController {
@RequestMapping(value = "/index", method = RequestMethod.GET)
public ModelAndView welcomePage(Model model) {
return new ModelAndView("index","unixModel11", new UnixModel());
}
@RequestMapping(value = "/loginUNIX", method = RequestMethod.POST)
public String checkUnix(@ModelAttribute("unixModel11")UnixModel
unixModel,ModelMap模型){
model.addAttribute( “username” 的,unixModel.getUserName());
model.addAttribute("host", unixModel.getHost());
model.addAttribute("port", unixModel.getPort());
return "result";
}
}
的index.jsp无数排查
排查应用
<tr>
<td><form:label path="host">Host Name</form:label></td>
<td><form:input path="host" /></td>
</tr>
<tr>
<td><form:label path="userName">User Name</form:label></td>
<td><form:input path="userName" /></td>
</tr>
<tr>
<td><form:label path="port">Port Number</form:label></td>
<td><form:input path="port" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit"/>
</td>
</tr>
UnixModel.java:
package com.myriad.ihc。豆;
public class UnixModel {
private String host;
private String userName;
private Integer port;
公共字符串和getHost(){
return host;
}
公共无效setHost(String host)在{
this.host = host;
}
公共字符串getUserName(){
return userName;
}
公共无效setUserName(用户名字符串){
this.userName = userName;
}
公共整数的getPort(){
return port;
}
公共无效setPort (整数端口){
this.port = port;
}
}