日期:2014-05-18  浏览次数:20777 次

我的程序出错了,谁能帮我看看???
session.setAttribute( "int ",   jf);
int   i   =   Integer.parseInt((String)session.getAttribute( "int "));
String   sql= "insert   into   user_zc   (jf)   values( "+i+ ") ";
stmt.executeUpdate(sql);


抱这个错误?为什么啊?
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.bbs1.top_005fadd_005fjf_jsp._jspService(top_005fadd_005fjf_jsp.java:65)
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)




------解决方案--------------------
把jf打印出来,看是什么数值
------解决方案--------------------
session.setAttribute( "int ", jf);可以在这里先给个固定的值看看,是什么原因
------解决方案--------------------
session.setAttribute( "int ", jf);中jf是什么??
------解决方案--------------------
楼上的对