>Hello,
>I am checking whether a session is inactive for more
>then 1 minute by the following:
>if((session.getLastAccessedTime())<(System.currentTimeMillis()
>- 60000)){
>out.println("INACTIVE FOR MORE THEN 1 minute");
>session.invalidate();
>res.sendRedirect("http://mahtanjg/complaintsys/relogin.htm");
>}
>
>'INACTIVE FOR MORE THEN 1 minute' is printed and the
>session is invalidated but the redirection does not
>take place.
>I am definitely missing something over here, can
>someone please explain.
>Thanks.
I think the problem here is that the redirect call occurs after you have
started doing output to the page. Redirects are effected by sending a
header to the browser, instructing it to show a new page. But since you
have started doing output to the page (i.e., the "INACTIVE..." message),
it's too late to send a header to the browser since you've already started
to provide content.
A couple of possible work-arounds:
1. Put your "INACTIVE..." message at the top of the page you're redirecting to,
instead of in your servlet output.
2. Include JavaScript in your servlet output to perform the redirection for
you.
The disadvantage here is that the user may have disabled JavaScript.
- Mark
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html