Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session timeout implementation

 
naveen putrevu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • 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
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • 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



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic