File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Session timeout not calling ActionForm's reset() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session timeout not calling ActionForm Watch "Session timeout not calling ActionForm New topic
Author

Session timeout not calling ActionForm's reset()

mona mittal
Greenhorn

Joined: Jan 26, 2006
Posts: 7
Hi I have a JSP page which is having some fields that are getting populated from its ActionForms reset method. Everything is working fine. Also worth mentioning the scope for it is "session".

Now the problem arises when I am on this page and session timeouts. then on refreshing or while attempting to go to next page, using a button, it takes me to the login page. Thats also fine. However, when again logged it, I go to that page again, it doesnt have any data. I tried to debug it and found out that in this kind of situation the reset method in the associated page's ActionForm is not getting called and thus, the data is not getting fetched from the database. I am using Hibernate to access the database and thus to fetch data needs
Session session = HibernateUtil.currentSession();
Query query = session.createQuery("from Book book");

I am not understanding where I am getting wrong. Also, I am running it on Tomcat server.

Looking forward for some help.

Thanks a lot.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If the application is behaving differently when the session times out and you log in again than it does when you first log in, it stands to reason that something isn't getting reset properly.

The first thing I'd try would be to put some logic in the login action that would make sure nothing's hanging on from a previous session. Do a session.removeAttribute() on all your session scoped form beans. I'm not that familiar with Hibernate, but maybe there's also something you can do there to make sure you're starting with a fresh session.


Merrill
Consultant, Sima Solutions
mona mittal
Greenhorn

Joined: Jan 26, 2006
Posts: 7
Thanks a lot. It worked for me. The reason for this strange behaviour was that the page's form attribute was not getting removed from the session after it timeout.

Much Thanks.
Mona
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session timeout not calling ActionForm's reset()
 
Similar Threads
NoSuchEntityException
SQL Error
Strus 1.1: Dropdown select with reset and multi-page form in session
Tomcat 7 maintaining more than one session
To: John Carnell, Re: Method Overrides