beacuse http is stateless protocol,after sending response to browser(client) server did not khow client,
on next request server checks jsessionid if it is present then server going to know ohhh that is client we served before,
if jsessionid is null server going to create new session.
Then if we close browser we can not notify server.
this is I know correct me experts, if any way to do this.
but for session timeout you can use HttpSessionListener.
Hope this will help.
please check JavaRanch naming policy
vicky Aggarwal wrote:But I m setting a flag in my database for user logged in.
Which i reset when user logout and .
so if user close browser without doing logout.
He can't log in again till previous session time out.
How i can implement desire functionality ...
That's simple ! As you had flag set to 1 for the same user one who closed the browser, you just need to check the session associated with the coming request and if it has a valid session, you show the user "welcome page". Try this out.
Sagar Rohankar wrote:But, on second loging in process from different browser, you can check that the user has already been signed in (by looking at flag) and you can (re)assigned that corresponding present session back to him. I never tried this idea, like re assigning session, but give it a try !
In case of I don't know that first log in is using or not (Browser closed or not)
So i can't pass session to Second .. because my motive to keep one user log in on single place.
Pavel Kubal wrote:Try to have a look at HttpSessionListener, I think this might solve your problem (at least partially). Keep user id in session and when session is destroyed, simply set the flag to 0. But session is going to be destroyed after the specified timeout.
Thanks a lot for your reply ...
Already implement your suggestion ....
Stuck on single point (browser close)
vicky Aggarwal wrote:Stuck on single point (browser close)