180onwarding
![](images/star2.gif) ![](images/star1.gif) ![](images/star1.gif) ![](images/star1.gif)
发贴: 19
|
于 2006-04-27 14:42
![user profile](images_zh_CN/icons/icon_profile.gif) ![send a private message to user](images_zh_CN/icons/icon_pm.gif) ![reply to post](images_zh_CN/icons/icon_quote.gif) ![search all posts by](images_zh_CN/icons/icon_find.gif) ![select and copy to clipboard.
ie only, sorry for netscape users:-)](images_zh_CN/icons/icon_copy.gif)
这个sess_use.jsp为什么运行出错? <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head>
<body> <center> <font size="5" color="#0000FF"> 存取session数据</font> <br /> <hr /> <br /> <% int num=0; Object obj=session.getAttribute("Num"); if (obj==null) {session.setAttribute("Num",String.valueOF(num)); } else { num=Integer.parseInt(obj.toString()); num+=1; session.getAttribute("Num",String.valueOf(num)); } %> </center> <font size="4"> session中的Num的值为:<font color="#FF0000"> <%=num%></font>
</body> </html> 错误信息是: org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 14 in the jsp file: /sess_use.jsp
Generated servlet error: [javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\sess_use_jsp.java:59: cannot resolve symbol symbol : method valueOF (int) location: class java.lang.String {session.setAttribute("Num",String.valueOF(num)); ^
An error occurred at line: 14 in the jsp file: /sess_use.jsp
Generated servlet error: C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\sess_use_jsp.java:65: getAttribute(java.lang.String) in javax.servlet.http.HttpSession cannot be applied to (java.lang.String,java.lang.String) session.getAttribute("Num",String.valueOf(num)); ^ 2 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:248) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187) at javax.servlet.http.HttpServlet.service(HttpServlet.java:809) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534)
|