Stéphane Zuckerman wrote:
Senthilrajan VS a écrit :
Thanks for your response. Can u please tell me how can I close the
connection if the user close the window directly because I am not
maintain
any session in the window
These are two unrelated events : you want a client-side event to create
a server-side event. I don't know enough JavaScript to help you an
"onClose" event (I don't even know if that exists). You'd better use a
link to make the session close, and if you really don't want to have a
session to stay opened too long, just shrink its timeout to a few
seconds. :-)
You may not be able easily to trigger a server-side session expiry event on
window close, but the session will still expire and that *does* generate a
server-side event.
Set up a session listener in web.xml and have your listener do the session
clean-up, including any DB connections you have stored in your session.
Note: personally, I'd avoid associating a DB connection with each session
like this, since it will limit how far the application can scale. The
number of users it can support will be limited by the number of database
connections you can cope with. Connection pools are designed to allow
connections to be reused by different requests/sessions/users inexpensively
precisely to avoid this kind of problem.
L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]