This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Where to write this method in my application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Where to write this method in my application?" Watch "Where to write this method in my application?" New topic
Author

Where to write this method in my application?

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Folks,
I had a application which is deployed on IBM Websphere Application Server 4.0.1 Advanced Edition for MultiPlatforms.The application is abt tracking of users which consists of Jsps and EJBs.Where should i write the methods for HttpSessionListener in my application.Please give me the suggestions.
Thanks in Advance.
Ravi
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
create a class which should implement that httpsessionlistener interface and then put it in the session.
in this you can implement the methods and do work like initializations and cleanup.
Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Prabhat,
Thanks for your response.Can u send me a piece of code related it.
Thanks in advance.
Ravi
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
Here is it. edit it to suit ur needs
Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Prabhat,
Thanks for the code.Just one more question.How do i keep this class in the session object and track the users.
Thanks in Advance.
Ravi
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
The idea is to use place this in application scope.
Use a Hashtable to store users in. Store the hashtable in the application scope. You can modify the code in the previous post to do this.
Then when a session expires, you have to have an event hook to log them out. You do this by implementing the HttpSessionListener interface. Below is a sample of this.


comp.lang.javascript FAQ: http://jibbering.com/faq/
 
 
subject: Where to write this method in my application?
 
Similar Threads
Localization
CSS files in an Application
Identifying which users certificate was used to authenticate
java and RFID
How to write a JNLP Dermo?