There is no session.isInvalid() method - that wouldn't make any sense anyway.
If you have an actual session to ask if it's valid or not, how could it ever
be invalid? There is an isNew() method, and I have not used this, but from
reading the spec it doesn't sound like it will do the trick.
There is a way to define an errorPage, a page that your JSP will forward to if
it throws an Exception. <%@ page errorPage="relativeURL" %> You'll have to
put this in each of your pages though, so it might not be what you're looking
for, although then all the logic to handle the exception would just be in the
errorPage.
You could also look into binding the session by creating an object that
implements HttpSessionBindingListener. Then when the session expires, the
valueUnbound( event ) method will be called by the servlet engine. You could
put code in that method to handle this case.
Hope this helps.
-Jeff
Michael
Molloy To: "Tomcat Users List"
<[EMAIL PROTECTED]>
<mmolloy@ncyc cc:
les.com> Subject: Re: Redirect after session
expires?
02/13/02
09:54 AM
Please
respond to
"Tomcat Users
List"
Well, we're trying to keep as much logic out of the jsps as possible, so if
there is a setting for web.xml or something to foward all pages that throw
exceptions to a certain url, that's what I'm looking for.
I appreciate your suggestion, and if that's what we need to do, we'll do it,
but I'd like to know about any other possibilities, also.
Thanks
--Michael
On Wed, 13 Feb 2002 15:37:53 +0000
David Cassidy <[EMAIL PROTECTED]> wrote:
> is there a session.isInvalid() method ?
>
> If so ... :)
>
> D
>
>
>
> Michael Molloy wrote:
>
> > I've got an application that builds menus when a user logs in and sticks
the menus in an object which I then put inside the session. All subsequent
jsps get their menu from that object in the session.
> >
> > However, when their session expires and they try to access a jsp, they get
a NullPointerException, as expected.
> >
> > How can I catch that error and redirect them to the logon page? Or is
their some other way to handle it? Is there a better way than putting some if
else statements in the jsp to check the session for the menu object?
> >
> > Thanks
> > --Michael
> >
> > --
> > To unsubscribe: <mailto:[EMAIL PROTECTED]>
> > For additional commands: <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>