w***f 发帖数: 46 | 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 | g*****g 发帖数: 34805 | 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
| w***f 发帖数: 46 | 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.
| l**d 发帖数: 42 | 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.
| l**d 发帖数: 42 | 5 顺便说一下,HttpSessionContext出于安全原因已经deprecated了。不过
现在大多数Application都还支持。如果不用它,可以用Session Event Listener
trace Session的产生和结束。
【在 l**d 的大作中提到】 : 哪用这么复杂?检查Session就是了。有的Session绑了用户(即login过), : 则是login用户。没有绑定的,则是anonymous。
|
|