RE: LookupDispatchAction default value?
Danny Mui wrote: I extended the dispatch action to do something like that: in execute() { ActionForward forward = null; if (mapping.getParameter() == null || .equals(mapping.getParameter())) { forward = executeAction(mapping, form, request, response); } else { forward = super.dispatchMethod(mapping,form,request,response, mapping.getParameter()); } return forward; } i'm a little weirder, i like to declaratively tell my action which to execute. so extending the if statement to look at the request/form is possible. this may not be lookupdispatchaction but close enough i guess? I don't quite understand where this code lives. Is this in a class that extends Action? Or have you subclassed LookupDispatchAction and fixed the execute() method? -- Wendy
Re: LookupDispatchAction default value?
Sorry to have muddled the waters too much, I assumed too much...Having looked at the LookupDispatchAction code, I can now make a slightly more educated reply ;). Yeah I think you're going to have to workaround the parent method. public class DefaultLookup extends LookupDispatchAction { public ActionForward execute(.){ if (request.getParameter(mapping.getParameter()) == null) { return defaultMethod() } else return super.execute(); } public abstract ActionForward defaultMethod() ; } This should work! i think... danny Wendy Smoak wrote: Danny Mui wrote: I extended the dispatch action to do something like that: in execute() { ActionForward forward = null; if (mapping.getParameter() == null || .equals(mapping.getParameter())) { forward = executeAction(mapping, form, request, response); } else { forward = super.dispatchMethod(mapping,form,request,response, mapping.getParameter()); } return forward; } i'm a little weirder, i like to declaratively tell my action which to execute. so extending the if statement to look at the request/form is possible. this may not be lookupdispatchaction but close enough i guess? I don't quite understand where this code lives. Is this in a class that extends Action? Or have you subclassed LookupDispatchAction and fixed the execute() method? -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: LookupDispatchAction default value?
I extended the dispatch action to do something like that: in execute() { ActionForward forward = null; if (mapping.getParameter() == null || .equals(mapping.getParameter())) { forward = executeAction(mapping, form, request, response); } else { forward = super.dispatchMethod(mapping,form,request,response, mapping.getParameter()); } return forward; } i'm a little weirder, i like to declaratively tell my action which to execute. so extending the if statement to look at the request/form is possible. this may not be lookupdispatchaction but close enough i guess? well hth Wendy Smoak wrote: I'm using LookupDispatchAction, which uses the 'action' request parameter to call the appropriate method. However, when the 'action' parameter is missing from the request, it dies as expected: javax.servlet.ServletException: Request[/processContact] does not contain handler parameter named action Is there a way to specify a default for the parameter it's supposed to use? If not, I was thinking of using a Filter to make sure that the request parameter is present, and to insert it if necessary. (Seems to me you can't add request parameters, only attributes, but I haven't tried it yet.) Have I missed something obvious or do you have any suggestions for handling this situation? Also, any advice for custom error pages? I have a custom page for my own DAOException class, but these are Error 500's, with different messages. Is it possible to have a different error page for does not contain handler parameter vs. other ServletExceptions that also show as code 500? -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org