一个简单的计数器中的问题?

firstname 2002-11-26 11:54:35
我源文件为:
init.jsp
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<BODY BGCOLOR="#FFFFFF">
<%
//统计在线人数
application.setAttribute("counter",new Integer(0));
out.println(application.getAttribute("counter"));
//记录在线人名
application.setAttribute("onlineName",new String(""));
out.println(application.getAttribute("onlineName"));
%>
</BODY>
</HTML>
count.jsp
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

</head>
<BODY BGCOLOR="#FFFFFF" onUnload="javascript:cancel();">
<%
Integer i=(Integer)application.getAttribute("counter");
String name=(String)application.getAttribute("onlineName");
//StringBuffer total=new StringBuffer(name);
%>

<font color="blue">
<%out.println((String)Session.getAttribute("username"));%>您好:
</font>
<br><font color="blue">
当前在线人数:<%=i%>
</font>
<br>
<font color="red">
在线人总名册:<%out.println(name);%>
</font>

</BODY>
</HTML>
运时出现下列错误:
An error occurred at line: 14 in the jsp file: /count.jsp

Generated servlet error:
D:\Apache Tomcat 4.0\work\Standalone\localhost\_\count$jsp.java:68: Undefined variable or class name: Session
out.println((String)Session.getAttribute("username"));
这是为什么,怎样改?
急急....

...全文
74 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
szkxy 2002-11-26
  • 打赏
  • 举报
回复
session要小写!
leonzhao 2002-11-26
  • 打赏
  • 举报
回复
小写,session
yh6241 2002-11-26
  • 打赏
  • 举报
回复
<%out.println((String)session.getAttribute("username"));%>中session要小写另外在文件头要加上
<%@page contentType="text/html;charset=gb2312"%>

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧