再來看看現在我們怎麼得到一個當前在線的用戶列表
<body bgcolor=
<table cellspacing=
<tr >
<td style=
</td>
<td style=
</td>
<td style=
</td>
<td style=
</td>
</tr>
<%
Vector activeSessions = (Vector) application
if (activeSessions == null)
{
activeSessions = new Vector();
application
}
Iterator it = activeSessions
while (it
{
HttpSession sess = (HttpSession)it
JDBCUser sessionUser = (JDBCUser)sess
String userId = (sessionUser!=null)?sessionUser
%>
<tr>
<td nowrap=
<td nowrap=
<td nowrap=
<%= BeaconDate
<td class=
<%= BeaconDate
</tr>
<%
}
%>
</table>
</body>
以上的代碼從application中取出activeSessions
這樣
這是一個非刷新模型的例子
[
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20686.html