有一个类,X.Java.
如下两行,我正在做
request.getSession.setAttribute("count",String.valueOf(rsp.getCount()));
在上面我从数据库中获取计数rsp.getCount()
。这getcount()
是整数类型,我将更改为 String asString.valueOf(rsp.getCount()
并设置为一个属性 as count
。
有一个 JSP 作为 X.jsp 现在我正在使用getAttribute
并将值存储在类型failCount
变量中string
。
String failCount = request.getSession.getAttribute("count");
现在我想将此值转换为整数类型,因为我写了这一行
int countInt = Integer.parseInt(failCount);
我收到如下错误
127039 13-02-26 17:13:35 ERROR http-10.18.2.105-12205-Processor4 - <JSPFilter ServletException> - test.abc.common.filter.JSPFilter.doFilter(JSPFilter.java:111)
org.apache.jasper.JasperException: Exception in JSP: abc/x.jsp:66
63:
64: }
65: String failCount = (String)request.getSession().getAttribute("failCount");
66: int failCountint = Integer.parseInt(failCount);
67: //System.out.println(failCountint);
68:
69:
Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:489)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:247)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1105)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:841)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
请帮我解决这个问题。