On 6/25/07, Xavier Vanderstukken <[EMAIL PROTECTED]> wrote:
Good morning,

I need to subclass the LookupDispatchAction to write a
"BaseLookupDispatchAction" to centralize the UserRole check of my
application (etc.).

I try the following piece of code :

public abstract class BaseLookupAction extends LookupDispatchAction {

        public ActionForward execute(ActionMapping mapping, ActionForm form,
                        HttpServletRequest request, HttpServletResponse 
response) {

                        try{
                                        //Check des users puis


                                        ActionForward 
succes=super.execute(mapping,form,request,response);
                                        return succes;
                        }
                        catch(Exception ex)
                        {
                                ex.printStackTrace();
                                ActionMessages errors = new ActionMessages();
                                ActionMessage error = new 
ActionMessage("error.fatal");
                                errors.add(ActionErrors.GLOBAL_MESSAGE,error);
                                saveErrors(request, errors);
                                return mapping.findForward("error");
                        }


The problem with that code is that I can not use my CustomErrorHandler
because the signature of the execute method does not throw an
exception.

I checked LookupDispatchAction and it does declare Exception as being
thrown on the execute method - so I don't understand why you're having
a problem - what version of Struts are you using?

Niall

So I must catch it and manually forward to an error page.

Is there a better way to do that?
        }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to