• 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

how to use session in struts ?

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have to use session in my program.
I am using STRUTS.
Anybody please tell me how to invalidate session in STRUTS.

Thanks in advance

harish pathak
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by harish pathak:
Hi all,

I have to use session in my program.
I am using STRUTS.
Anybody please tell me how to invalidate session in STRUTS.

Thanks in advance

harish pathak




Greetings,


From my understanding, invalidating a session of Struts application can be achieved almost the same as most of the web services.

What you simply have to do is retrieve the Session using request.getSession(); and then, invalidate it with session.invalidate() method..
 
harish pathak
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.

I don't want tobe logged out (sign off) but I want to make the session invalidate after some period of time. And want to redirect to login page if user is not activated in the last 30 minutes.

As I have made LoginForm in struts and it sends the request to ActionServlet. So is there any configuration to be made in this servlet so that after some period of time if user not activated in the last 30 minuted it redirect to login page.

I know we can make following configuration in jsp but as LoginForm redirect to ActionServlet so I want to make the session invalidate in this servlet

please reply soon.

Thanks

Harish pathak
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

put these lines in web.xml
<Session>

<SessionTime>18000</SessionTime>
</Session>


and in actionsevlets check whether session is valid or not if it is not valid then return findforward("login")
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic