avatar
Who's online--JSP?# Java - 爪哇娇娃
w*f
1
Does anyone know how to implement a jsp program which can identify who's
online at the moment? I search for long time and can't find any jsp source
code.I want to know their number, ip address . Help appreciated!
Wu
avatar
g*g
2
Html is not persistent, you cannot know whether a user is online or not.
An approxmiation may look like this.
When you receive a request, update the user's last request time if he/she
is the DB, create new record if not(you have cookie, don't you).
Check every 5 minutes, remove those idle for 30 minutes or more from
Db. Assume users in DB are online.

【在 w***f 的大作中提到】
: Does anyone know how to implement a jsp program which can identify who's
: online at the moment? I search for long time and can't find any jsp source
: code.I want to know their number, ip address . Help appreciated!
: Wu

avatar
w*f
3
Thanks. As a request create a server session, I think it would be better to
check how many server session there are now and then compare their ip address
from request.Just don't know the details how to implement it. any example
codes?
I know this is a really tough and challenging question .Let'see who can finish
this task.Thanks.
Wu

【在 g*****g 的大作中提到】
: Html is not persistent, you cannot know whether a user is online or not.
: An approxmiation may look like this.
: When you receive a request, update the user's last request time if he/she
: is the DB, create new record if not(you have cookie, don't you).
: Check every 5 minutes, remove those idle for 30 minutes or more from
: Db. Assume users in DB are online.

avatar
l*d
4
哪用这么复杂?检查Session就是了。有的Session绑了用户(即login过),
则是login用户。没有绑定的,则是anonymous。

【在 g*****g 的大作中提到】
: Html is not persistent, you cannot know whether a user is online or not.
: An approxmiation may look like this.
: When you receive a request, update the user's last request time if he/she
: is the DB, create new record if not(you have cookie, don't you).
: Check every 5 minutes, remove those idle for 30 minutes or more from
: Db. Assume users in DB are online.

avatar
l*d
5
顺便说一下,HttpSessionContext出于安全原因已经deprecated了。不过
现在大多数Application都还支持。如果不用它,可以用Session Event Listener
trace Session的产生和结束。

【在 l**d 的大作中提到】
: 哪用这么复杂?检查Session就是了。有的Session绑了用户(即login过),
: 则是login用户。没有绑定的,则是anonymous。

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。