It appears that what we have are different strategies for determining the method name. Given that, wouldn't it make more sense to have a single version of DispatchAction (perhaps called StrategyDispatchAction) which relies on a named strategy class to resolve the method name
Something like this: public interface DispatchMethodNameResolver { String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter); } With four implementations: RequestParamMethodResolver LookupMethodNameResolver MappingMethodNameResolver SimpleMethodNameResolver The DispatchMethodNameResolver class could be provided via an (overridden) method, or a config param for StrategyDispatchAction. The latter approach provides a nice seperation of your dispatch methods from the means by which they are resolved. Also, it seems somewhat dubious that HttpServletResponse is required as an input parameter. Tom Drake Here are two of the implementations. I'll leave the others to your imagination. public class RequestParamMethodNameResolver { public String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception { // Identify the method name to be dispatched to. // dispatchMethod() will call unspecified() if name is null return request.getParameter(parameter); } } public class MappingMethodNameResolver { public String getMethodName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String parameter) throws Exception { // Identify the method name to be dispatched to. // dispatchMethod() will call unspecified() if name is null return parameter; } } -----Original Message----- From: Michael McGrady [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 3:08 PM To: Struts Developers List Subject: Re: DispatchAction Hubert Rabago wrote: > public ActionForward execute(_usual_params) { > RequestUtils.dispatch(this, _usual_params); > } > This will work fine for SimpleDispatchAction, in fact I LOVE IT and I am going to do it, if you don't, but this would not replace DispatchAction, LookupDispatchAction or MappingDispatchAction, and there probably is a lot of code out there with those actions. You would have to provide the following four options. RequestUtils.dispatch(this,_usual_params); RequestUtils.lookupDispatch(this,_usual_params); RequestUtils.mappingDispatch(this,_usual_params); RequestUtils.simpleDispatch(this,_usual_params); I want to emphasize, however, that RequestUtils.simpleDispatch(this,_usual_params) will do everything that the others do and do what they do more simply, but it is based on different data. Michael --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]