📄 state.jsp
字号:
<!--this file are used to show the msg about this chat-->
<html>
<meta http-equiv="refresh" content="120">
<title>
</title>
<head>
<style type="text/css">
<!--
a:link,a:visited {text-decoration:none;color:white}
a.lb:hover{text-decoration:underline;color:black}
a:hover {text-decoration:underline;color:#333333}
a:active{text-decoration:none;color:black}
.cn0 {font-family: "宋体"; font-size: 12.8px}
.cn1 {font-family: "宋体"; font-size: 12.8px; line-height:150%}
.cn2 {font-family: "宋体"; font-size: 12.8px; line-height:150%; letter-spacing: 2px}
.cn3 {font-family: "宋体"; font-size: 12.8px; line-height:150%;color:#336699}
.cn4 {font-family: "宋体"; font-size: 12.8px; line-height:170%}
.cn5 {font-family: "宋体"; font-size: 12.8px; line-height:170%; letter-spacing: 2px}
.cn6 {font-family: "宋体"; font-size: 12.8px; line-height:170%;color:#336699}
.cnt0 {font-family: "宋体"; font-size: 14.5px}
.cnt1 {font-family: "宋体"; font-size: 14.5px;line-height:160%}
.cnt2 {font-family: "宋体"; font-size: 14.5px;line-height:160%; letter-spacing: 3px}
.cnt3 {font-family: "宋体"; font-size: 14.5px;line-height:160%;color:#336699}
.e0 {font-family: "Arial","tahoma"; font-size: 9pt}
.e1 {font-family: "Arial","tahoma"; font-size: 9pt;line-height:140%}
.e2 {font-family: "Arial","tahoma"; font-size: 14.5px;line-height:160%}
-->
</style>
</head>
<body bgcolor="#669999">
<!--设置中文字符集-->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.Hashtable" %>
<%
Hashtable userLife=(Hashtable)getServletContext().getAttribute("userLife");
Hashtable userIP=(Hashtable)getServletContext().getAttribute("userIP");
Vector chat1UserVector=(Vector)getServletContext().getAttribute("chat1User");
Date currentDate=new Date();
Long _userTime=(Long)userLife.get((String)session.getValue("username"));
long userTime=_userTime.longValue();
long currentTime=currentDate.getTime();
long mis=currentTime-userTime;
if (mis>(long)240000)//4 minutes
{
boolean usertimeisexist=userLife.containsKey((String)session.getValue("username"));
boolean useripisexist=userIP.containsKey((String)session.getValue("username"));
boolean usernameisexist=chat1UserVector.contains((String)session.getValue("username"));
if (usertimeisexist==true)
{
Long tempUserTime=(Long)userLife.remove((String)session.getValue("username"));
}
if (useripisexist==true)
{
String tempUserIP=(String)userIP.remove((String)session.getValue("username"));
}
if (usernameisexist==true)
{
boolean booltempUser=chat1UserVector.remove((String)session.getValue("username"));
}
}
getServletContext().setAttribute("userLife",userLife);
getServletContext().setAttribute("userIP",userIP);
getServletContext().setAttribute("chat1User",chat1UserVector);
%>
<p> </p>
<div align="center">
<p><span class="cnt0">聊天室1</span></p>
</div>
<table cellspacing="2" cellpadding="2" border="0" width="80" align="center">
<tr>
<td class="cn1">帮助文件</td>
</tr>
<tr>
<td class="cn1"><a href="admin_init.jsp" target="_new">系统管理</a></td>
</tr>
<tr>
<td class="cn1"><a href="listuser.jsp" target="_new">察看聊客</a></td>
</tr>
<tr>
<td class="cn1"><a href="listchat.jsp" target="_new">察看房间</a></td>
</tr>
<tr>
<td class="cn1">换个房间</td>
</tr>
<tr>
<td class="cn1"><a href="leavechat.jsp" target="_top">回到论坛</a></td>
</tr>
<tr>
<td class="cn1"><br>
聊天论题:<br><% out.println((String)getServletContext().getAttribute("chat1Topic"));%><br></td>
</tr>
<tr>
<td class="cn1"><br>
当前在聊:<br>
<%
Vector temp=(Vector)getServletContext().getAttribute("chat1User");
out.println(temp.size());
%>人<br></td>
</tr>
<tr>
<td class="cn1"><br>
总共在聊:<br>
<%
int totalnum=0;
temp=(Vector)getServletContext().getAttribute("chat1User");
totalnum+=temp.size();
temp=(Vector)getServletContext().getAttribute("chat2User");
totalnum+=temp.size();
out.println(totalnum);
%>人<br></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -