*/
protected void executeAction() {
String actualName = findString(name, "name", "Action name is required. Example: updatePerson");
if (actualName == null) {
throw new StrutsException("Unable to find value for name " + name);
}
// handle "name!method" convention.
final String actionName;
final String methodName;
ActionMapping mapping = actionMapper.getMappingFromActionName(actualName);
actionName = mapping.getName();
methodName = mapping.getMethod();
String namespace;
if (this.namespace == null) {
namespace = TagUtils.buildNamespace(actionMapper, getStack(), req);
} else {
namespace = findString(this.namespace);
}
// get the old value stack from the request
ValueStack stack = getStack();
// execute at this point, after params have been set
ActionInvocation inv = ActionContext.getContext().getActionInvocation();
try {
proxy = actionProxyFactory.createActionProxy(namespace, actionName, methodName, createExtraContext(), executeResult, true);
// set the new stack into the request for the taglib to use
req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack());
req.setAttribute(StrutsStatics.STRUTS_ACTION_TAG_INVOCATION, Boolean.TRUE);
proxy.execute();
} catch (Exception e) {
String message = "Could not execute action: " + namespace + "/" + actualName;
LOG.error(message, e);
if (rethrowException) {
throw new StrutsException(message, e);
}
} finally {
req.removeAttribute(StrutsStatics.STRUTS_ACTION_TAG_INVOCATION);
// set the old stack back on the request
req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);