0

Hi,
i have developed an web application using JSF.
In that, if the user remains idle in the application for more than 15min then their session should expire.
i have tried it by giving <session-timeout> tag value as 15 min in web.xml.
but i don't know how to redirect the user to the login page after session timeout.
Is it possible to use session.setMaxInactiveInterval() in my application to expire the session after that particular time?
please give me some ideas to solve this issue.

Regards,
Indu

4
Contributors
6
Replies
12
Views
7 Years
Discussion Span
Last Post by indu_ss4
0

i'm not using seam.
I'm using JSF along with Richfaces.
can u suggest me some other ideas on how to solve it?

0
HttpSession session = request.getSession();
if(session==null){
	RequestDispatcher rd = context.getRequestDispatcher("/demo/inner.jsp");
	rd.forward(request,response);
}

Cooked from different google links and untested. Try it and see.
I'm not JSP maverick either

0

Hi,
I have used like this before.
But now what i have to do is to calculate the session time of each user. I can do this if the user presses the logout button by calling a function. I don't know to call the same function when the session expires automatically.

Suppose,if the user login into the application and performs some operations then if the user remains idle for the maximum session time out i have to calculate the session time and then redirect them back to login page.
hence i have to call the function to calculate the session time before redirecting to login page after session time out.
hope u can identify my issue.
waiting for reply to solve this.


Regards,
Indu

0

When the use logs in, put its username in the session:

session.setAttribute("USER", username);

At the beginning of each page you can do this:

String username = (String)session.getAttribute("USER");
if(username==null) { // session expired
// FORWARD WITH ANY WAY YOU WANT

// I don't know about this one. I usually use the forward tag
RequestDispatcher rd = context.getRequestDispatcher("/demo/inner.jsp");
rd.forward(request,response);
}

evstevemd

0

I think i didnt clearly explain my problem in my previous post.
Actually,I have to enter the session time of each user in the database. To do this i have a function in the bean. I can call this function when the user click the logout button and then redirect the user to login page from that function. But i cannot call this function when the session expires automatically after the session time out. I'm using jsf with richfaces.
Thanks in advance.

Regards,
Indu

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.