On 8/28/06, Thomas Hamacher <[EMAIL PROTECTED]> wrote:
My current implementation is close to the default struts-implementation, so the "UnauthorizedActionException" is thrown, if the user is not allowed to access this action. But in this case the tomcat shows an error 500 with the given error-messages. What I´d like better is, that I create a new ActionMessage telling the user that he is not allowed to access this page, add this message to the error-messages in the request-scope and redirect him back to the page where he came from. This way he only gets a message, but is not completely thrown to an error page. What would the way to do this with the ComposableRequestProcessor? Can anyone give me an example or an idea, how to do this?
Having never tried it, I'm not certain of the details. How about configuring an <exception> in struts-config.xml, and providing a custom ExceptionHandler. Instead of using the 'path' attribute, have your exception handler return mapping.getInputForward() which should send you back to the page with the form. Or if that's not the right place, maybe there is something else in the request or the available Struts config objects that will give you enough information to construct an ActionForward to return. Nothing here is specific to the ComposableRequestProcessor -- I haven't had occasion to modify the request processing chain *or* use a custom Exception handler, so it's quite possible there's a better way to do it. If nothing else, maybe this message will cause someone to say, "Don't do that!" :) http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/action/ExceptionHandler.html -- Wendy --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]