I'm trying to use a central error page where I can diplay errors that arise when a user's account has been locked or similar (it is displayed directly from the login page using an ActionForward). The page is also the result of a logoff action that is passed before the errors shall be displayed.
The workflow is like this:
Login-Page -> misbehaviour by user -> creating according message -> logoff action -> Logoff-Page displaying the message
My current solution uses a JSP that is being forwarded to from different actions. The error messages are placed using ActionError objects that are displayed on that particular page (ATM only once a time).
The problem is that I have not to use for these kind of forwards since this will remove previous action errors from the request whereas the request object itself stays the same!
How could a solution looks like that uses one error page for outputting these messages and also using the redirect directive?
Trying to use a form property does not really help since the messages are generated by one action and displayed by another one. Hence the resetting of this property cannot be done within the reseet-methode but has to be done by hand every time you use this property! That is not very comfortable!
So you have an action where there is an error. In that action you are getting the ActionForward to your logoff action. When you get that ActionForward, append "?errorCode=" + errNum to the forward that you return. In your logoff action, read the errorCode request parameter (or use a form to get the errorCode), and pull the message associated with that errorCode, add it to the actionerror object and it will be displayed on your logoff page.
It seems a bit "hackey" but it is the best solution I can come up with to fit your needs.