That's fine, but why would you need to warn the user that the session is
almost expired? As long as they are active any time within the 15 minutes
they will have another 15 minutes from the time last accessed. This isn't
really something you need to keep track of. The only thing you really need
to worry about is to have checks for session==null when you are using the
session object and, if so, do the appropriate thing.
If you code with proper null checks, you should never run into a
NullPointerException.
Jake
At 03:25 PM 4/25/2002 +0200, you wrote:
>I have found the answer so I give the contribution :
>
>
>//put this code in every page with a @page include
><%
>long timeout = (new Date()).getTime() - session.getLastAccessedTime();
>if(session==null || (timeout > session.getMaxInactiveInterval()*1000))
>{
> throw new MyException("Session has expired : <A HREF='" +
>response.encodeURL("login.jsp") + "'>reconnect</A>");
>}
>%>
>
>then catch the exception in error.jsp and print the message
>
>
>
>On Thursday 25 April 2002 10:16, Raphael Di Cicco wrote:
> > Hi
> >
> > my web application has a timeout of 15 minutes. I'm trying to figure out
> > how to check whether there is a timeout, and in this case warn the user to
> > come back to the login page (instead of a horrible NullPointerException).
> >
> > Did anyone come up with a JSP that's working with this ?
>
>
>--
>To unsubscribe: <mailto:[EMAIL PROTECTED]>
>For additional commands: <mailto:[EMAIL PROTECTED]>
>Troubles with the list: <mailto:[EMAIL PROTECTED]>