Tim, the Filter thing is a great idea, and it worked just fine. Thanks a million.
Now, I have another problem that I just can't figure out. After the session expires
and the user makes a request, he's sent to the login page by Tomcat. 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.
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 in 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.
Please, someone help me out here.
-----Original Message-----
From: Tim Funk [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 8:24 PM
To: Tomcat Users List
Subject: Re: Redirect to home page on logon
Use a filter. Its container independent.
The filter runs on the appropriate (or all) requests and would check if the
beans are in the session. If not - redirect.
OR
If all the pages set an error condition - you might be able to use an error
mapping directive in web.xml
-Tim
Tarek M. Nabil wrote:
> Hi everyone,
>
> I have an application that uses beans stored in the session context. If the user's
> session times out, he's asked to re-login on his next request. For this, I'm using
> J2EE security; I'm not doing it myself.
> After the user is finished with the re-login, he's supposed to complete his request,
> but the fact that the beans are not in the session anymore produces an error.
> Unfortunately, those beans are specific to the last request the user made, so I
> cannot re-initialize them in a listener for session creation.
>
> I was wondering if there's a way to configure security so that after the user logs
> in he's redirected to a certain page instead of being able to continue his last
> request.
>
> I know this can be done manually, but I would have to do it in every web component I
> have which is really tiresome. Any quick solutions?
>
> Any help is appreciated.
>
> I'm sorry that this question is not Tomcat specific, but I tried the
> servlet-interest list and got no responses.
>
> Thanks,
> Tarek M. Nabil
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]