On Mon, 13 Jan 2003, Rick Reumann wrote:
> Date: Mon, 13 Jan 2003 11:13:32 -0500 > From: Rick Reumann <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>, > Rick Reumann <[EMAIL PROTECTED]> > To: Struts List <[EMAIL PROTECTED]> > Cc: model struts <[EMAIL PROTECTED]> > Subject: Exceptions in DispatchActions > > Sorry to repost this yet another time. If maybe someone can just let > me know if they are successfully using declarative exception handling in > conjunction with DispatchAction methods that would be a start. Maybe > nobody even does this so I can just give up. If I know it is working > for others I'll persist. My original post was: > > > Hope someone could help with this.. > > If I use a normal Action and declare an exception in the action > configuration in the config file, everything works perfectly if that > Exception is thrown. > > However, when normally I like to use DispatchAction and I'm having > trouble getting the declarative Exception handling to work in > DispatchAction methods. Apparently just adding the appropriate throws > clause to the DispatchAction method doesn't work. The log will show > that the exception was thrown but the DispatchAction didn't handle it. > > Is there something I need to do differently to configure > DispatchAction methods to handle declaritive exceptions? > > Thanks for the help? > (Presuming 1.1b3 here) What is the method signature of the method you are forwarding to? It should be exactly the same as the execute() method - something like: public ActionForward saveCustomer(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ... some logic goes here ... if (bad thing happened) { throw new FooException(...); } } The FooException is thrown back to DispatchAction.dispatchMethod() wrapped inside an InvocationTargetException, but it's then unwrapped and rethrown directly back to the controller servlet. Therefore, you should be able to declare a handler for FooServlet in struts-config just the same as if this were a separate Action class. What are you actually seeing happen (i.e. what exception is seen by the controller servlet) when you try something like thie above? > -- > > Rick Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>