我有一个JSP页面,当List<Employee>从下面的方法中显示时,它可以正常工作<c:forEach>。
@RequestMapping(value = { "getAllEmployees", "/" })
public ModelAndView getAllEmployees() {
// logger.info("Getting the all Employees.");
List<Employee> employeeList = employeeService.getAllEmployees();
return new ModelAndView("employeeList", "employeeList", employeeList);
}
List<Employee>从下面的方法显示时,同一JSP会引发异常。
@RequestMapping("searchEmployee")
public ModelAndView searchEmployee(@RequestParam("searchName") String searchName) {
// logger.info("Searching the Employee. Employee Names: " + searchName);
List<Employee> employeeList = employeeService.getAllEmployees(searchName);
System.err.println("Employee count = "+employeeList.size());
return new ModelAndView("employeeList", "employeeList", employeeList);
}
这是堆栈跟踪:
java.lang.NumberFormatException: For input string: "id"
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
java.lang.Integer.parseInt(Integer.java:492)
java.lang.Integer.parseInt(Integer.java:527)
javax.el.ArrayELResolver.coerce(ArrayELResolver.java:151)
javax.el.ArrayELResolver.getValue(ArrayELResolver.java:64)
org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
org.apache.el.parser.AstValue.getValue(AstValue.java:169)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:943)
org.apache.jsp.WEB_002dINF.pages.employeeList_jsp._jspx_meth_c_005fout_005f0(employeeList_jsp.java:358)
org.apache.jsp.WEB_002dINF.pages.employeeList_jsp._jspx_meth_c_005fforEach_005f0(employeeList_jsp.java:312)
org.apache.jsp.WEB_002dINF.pages.employeeList_jsp._jspx_meth_c_005fif_005f1(employeeList_jsp.java:273)
org.apache.jsp.WEB_002dINF.pages.employeeList_jsp._jspService(employeeList_jsp.java:162)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
这是怎么引起的,我该如何解决?