Dhaval
Dhaval

Reputation: 29

How to update oracle table on session timeout in java Application

I need to update a database table in oracle when a http session of a user times out. How can I achieve this?

Thanks Dhaval Maheshwari.

Upvotes: 0

Views: 331

Answers (1)

Sathish
Sathish

Reputation: 4713

There are a couple of options you could think about. The first might be to use client side code (i.e. Javascript) to catch those types of events and then trigger the appropriate database update. The issue with that may be making sure in the client code you can identify which user has logged out.

The better option might be to use an HTTPSessionListener (see javax.servlet.http.HttpSessionListener) that will update your database table when a session is destroyed. If you are using the HttpSession to determine authorisation etc. then this might be the better choice.

Upvotes: 1

Related Questions