This is a good idea to me, but I don't see how you could implement this using the structure provided by LookupDispatchAction (see http://jakarta.apache.org/struts/api/org/apache/struts/actions/LookupDispatchAction.html) because it's not my subclass's implemented abstract method that determines which method to call but this LookupDispatchAction's execute method.
Right now all my Action classes extend this base class:
------------------------------------------
public abstract class ActionBase extends
LookupDispatchAction {
protected Map getKeyMethodMap() {
return null;
}
public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// if there is no dispatch map, return the
// default execute method
if (getKeyMethodMap() == null) {
//DO USEFUL STUFF
return defaultExecute(mapping, form,
request, response);
} else {
return super.execute(mapping, form,
request, response);
}
}
public abstract ActionForward defaultExecute
(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception;
}
---------------------------------------
The only problem is defaultExecute only gets called when there is no dispatch map.