• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session timeout not calling ActionForm's reset()

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
mona mittal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic