public abstract class FormBasedDispatchAction extends DispatchAction {
/**
* This class assumes that a DynaActionForm is associated with this action and that the form has a property called "method". * Whatever that property is set to is the method this class uses reflection to invoke.
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
//cast the generic form to a DynaActionForm DynaActionForm dynaForm = (DynaActionForm) form;
//pull out what "method" is set to String method = (String) dynaForm.get("method");
//execute that method return dispatchMethod(mapping, form, request, response, method); } }
My own thoughts are:
Positive:
Very simple :-)
Don't have to make a source code mod to your Action each time the text on a submit button in the JSP is added/changed like you do with DispatchAction
Negative:
It's a slight "abuse" of the Struts form object. Form's now would carry one bit of data that helps out the controller logic in addition to carrying user entered data.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]