@Override
protected ViewAdapter executeAction(Object actionBean, ActionContext context)
{
BasicSubmitAction action = (BasicSubmitAction) actionBean;
ActionForm form = context.getForm();
HttpServletRequest request = context.getRequest();
boolean cancelled = false;
if (request.getAttribute(Globals.CANCEL_KEY) != null)
{
cancelled = true;
}
if (form instanceof BindingForm && !cancelled)
{
action.preBind();
BindingForm validBindingForm = (BindingForm) form;
validBindingForm.bindInwards(actionBean);
}
ActionMapping mapping = context.getMapping();
String result = null;
if (cancelled)
{
result = action.cancel();
}
else
{
// now figure out what method to execute and do so
String parameterName = mapping.getParameter();
getHelper().checkParameterName(mapping, parameterName);
String methodName = getMethodName(context, parameterName);
if (methodName == null)
{
result = action.execute();
}
else
{
Method method = getHelper().getMethod(actionBean, methodName);
result = ReflectHelper.invokeMethod(actionBean, method, String.class);