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

firstname firstname 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我源文件为:
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"));
这是为什么,怎样改?
急急....

...全文
评论 3
收藏 已收藏
分享
返回顶部
firstname
Web 开发 81,107 成员 341,720 内容