• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

session timeout implementation

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

I am using struts2 for my webapp development. I am also using "MyFilterDispatcher.java" to process all incoming requests.

My requirement is: when a user doesn't access any part of the application for 2 mins; then redirect the user to login page. I've used <session-timeout>2</session-timeout> in web.xml. In addition to this, How do i redirect the user to login.jsp page now?


Thanks.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

naveen putrevu wrote:when a user doesn't access any part of the application for 2 mins; then redirect the user to login page.



when user send request, check the user session. if it is invalid then, redirect to the login page
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

As you are using struts2 so make one Interceptor like loginInterceptro which check your user session available or not ....

If user session not available with application just redirect to login page.

That login interceptor configure with Strut.xml file with your application and put that tag to every page with login required.


 
naveen putrevu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Nishan

I am already using an interceptor which extends "FilterDispatcher" by the way. The code goes something like this...

public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {

super.doFilter(req, res, chain);

}


Here, how do I check whether the user session is available or not?
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,


At the time of Login make one session object like user and check this user session at login interceptor.

I think this will help you ....

http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor



 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic