为什么最简单Session都会出现错误?

braveguy 2002-04-04 07:32:22
Error: 500
Location: /sh222/jsp/test2.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSPC:\Program Files\JBUILD6\jakarta-tomcat-3.2.3\work\localhost_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)

原文件:

<html>

<head>
<title>Session test</title>
<%@ page session="true" %>
</head>

<body>
<%
Session.setAttribute("UserName",firstName);
%>
</body>

</html>
...全文
8 点赞 收藏 2
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
huyuefox 2002-04-04
Session.setAttribute("UserName",firstName);这里session应该小写
回复
可乐加水 2002-04-04
应该是request.setAttribute
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告