首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

java.lang.ClassCastException: java.lang.Integer解决方法!

2014-01-26 
我在调试代码时遇到了这个问题出错信息如下 message description The server encountered an internal erro

我在调试代码时遇到了这个问题出错信息如下
message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.Integer
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.ClassCastException: java.lang.Integer
org.apache.jsp.personal.addEmployee_jsp._jspService(addEmployee_jsp.java:157)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.

我的相关页面代码是
<select name= "deptNum " style= "width:100px ">
  <option value= " "> --选择-- </option>
  <%
 
  Department dept=new Department();
  DepartmentBeanDAOImpl bean = new DepartmentBeanDAOImpl();
  Collection <Department> depts = bean.query(dept);
  for(Department dep: depts){
  System.out.println( "----====+++++ ");
  %>
  <option value= " <%= dep.getDeptNum()%> "> <%= dep.getDeptName()%> </option>
  <% System.out.println( "----==333333=+++++ ");} System.out.println( "----2222+++++ ");%>
</select>
这一部分代码中System.out.println( "----==333333=+++++ ");这一句是可以执行的
但是System.out.println( "----2222+++++ ");一句却不能执行,请大家帮忙看一下是什么原因呀?
谢谢大家了!

------解决方法--------------------------------------------------------
System.out.println( "----==333333=+++++ ");在循环内
System.out.println( "----2222+++++ ");在循环外
所以一定是使循环里的Department dep: depts这就有问题

        

热点排行