code068.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="pack02.code066" %>
<%@ page import="pack02.code067" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>session添加用户移除用户监听</title>
</head>
<body>
<%
code066 userList = code066.getInstance();
code067 trace = new code067();
String name = request.getParameter("user");
trace.setUser(name);
session.setAttribute("list", trace);
userList.addUserInfo(trace.getUser());
session.setMaxInactiveInterval(10); //10秒
%>
<textarea rows="8" cols="20">
<%
Vector<String> vector = userList.getList();
if(vector != null && vector.size() > 0)
{
for(int i=0;i<vector.size();i++)
{
out.println(vector.elementAt(i));
}
}
%>
</textarea>
</body>
</html>