Qm,
Thank you very much for your response. I had already done the filter thing upon the
advice of fellow developers on the Tomcat list. I still have another problem, though.
It's as follows.
After the session expires and the user makes a request, he's sent to the login page by
Tomcat (same happens on WebSphere 5). After he logs in, he's still sent to the error
page. Of course the filter intercepts this and redirects to the home page.
I still can't figure out, though, why the request is sent to the error page. It really
doesn't make sense.
I have my error pages configured as follows:
<!-- error pages -->
<error-page>
<error-code>500</error-code>
<location>/error.do</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error.do</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.do</location>
</error-page>
In error.do I do some logging, then forward to error.jsp. What's really driving me
crazy, is that in the case I was just describing, the request is sent directly to
error.jsp and it doesn't even go to error.do. I tried adding some debugging info in
error.jsp to see what error is happening, but, although the "isErrorPage" is set to
true, there's no exception object.
I went into the Tomcat server.xml and raised the debug level to 4 for both the host
and the engine, and still the Tomcat logs does not mention anything about the error
that causes the forwarding to error.jsp. I even checked stdout and stderr, nothing.
(Also after deployment on WebSphere 5, the same happens and there's nothing in the
logs).
What I can't understand is how the container knows about error.jsp, it's not mentioned
anywhere in my web.xml. The only place it's mentioned is in the struts-config.xml
file. I even changed it's name to something else, thinking that maybe error.jsp is
some default value or something like index.jsp, but it didn't help.
Any idea what's going on?
----------
If you're using recent enough tools (servlet 2.3 spec) then you could
write a servlet filter to do just this.
The idea is that the filter checks the existence of these session
objects and, should that fail, redirects the user to some sort of "Start
Over" page. If the objects do indeed exist in the session, the filter
passes control to the requested page.
Once you've written the filter itself, update your app's web.xml such
that this filter is placed before any of the pages requiring those
session objects.
I don't have a URL handy, but a search for "servlet filter" should
return lots of links on the subject.
-QM
----------
Tarek M. Nabil
___________________________________________________________________________
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