当前位置: 技术问答>java相关
为什么最简单Session都会出现错误?
来源: 互联网 发布时间:2015-04-30
本文导语: Error: 500 Location: /sh222/jsp/test2.jsp Internal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSPC:Program FilesJBUILD6jakarta-tomcat-3.2.3worklocalhost_8080%2Fsh222_0002fjsp_0002ftest_00032_0002ejsptest2_jsp_0.java:65: Undefined variab...
Error: 500
Location: /sh222/jsp/test2.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:Program FilesJBUILD6jakarta-tomcat-3.2.3worklocalhost_8080%2Fsh222_0002fjsp_0002ftest_00032_0002ejsptest2_jsp_0.java:65: Undefined variable or class name: Session
Session.setAttribute("UserName",firstName);
^
1 error
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
原文件:
Session test
Location: /sh222/jsp/test2.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:Program FilesJBUILD6jakarta-tomcat-3.2.3worklocalhost_8080%2Fsh222_0002fjsp_0002ftest_00032_0002ejsptest2_jsp_0.java:65: Undefined variable or class name: Session
Session.setAttribute("UserName",firstName);
^
1 error
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
原文件:
Session test
|
Session.setAttribute("UserName",firstName);这里session应该小写
|
应该是request.setAttribute