Class AbstractEventMappingDispatcher
- All Implemented Interfaces:
Serializable,Dispatcher
- Direct Known Subclasses:
ServletEventMappingDispatcher
parameter attribute of the
ActionMapping that matches a submission parameter. This is useful for
developers who prefer to use many submit buttons, images, or submit links on
a single form and whose related actions exist in a single action.
For utility purposes, you can use the key=value notation to
alias methods so that they are exposed as different form element names, in
the event of a naming conflict or otherwise. In this example, the
recalc button (via a submission parameter) will invoke the
recalculate method. The security-minded person may find this
feature valuable to obfuscate and not expose the methods.
The default key is purely optional, but encouraged when nothing
matches (such as the user pressing the enter key). If this is not specified
and no parameters match the list of method keys, the method resolution
returns null.
The order of the parameters are guaranteed to be iterated in the order specified. If multiple buttons were accidently submitted, the first match in the list will be dispatched.
- Since:
- Struts 1.4
- Version:
- $Rev$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe method key, if present, to use if other specified method keys do not match a request parameter.Fields inherited from class org.apache.struts.dispatcher.AbstractDispatcher
CANCELLED_METHOD_NAME, EXECUTE_METHOD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEventMappingDispatcher(MethodResolver methodResolver) Constructs a new dispatcher with the specified method resolver. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanisSubmissionParameter(ActionContext context, String methodKey) Determines whether the specified method key is a submission parameter.protected final StringresolveMethodName(ActionContext context) Resolves the method name by obtaining theparameterattribute from theActionMapping.Methods inherited from class org.apache.struts.dispatcher.AbstractMappingDispatcher
getDefaultMappingParameter, setDefaultMappingParameterMethods inherited from class org.apache.struts.dispatcher.AbstractDispatcher
dispatch, dispatchMethod, getDefaultMethodName, getMethod, invoke, isCancelled, unspecified
-
Field Details
-
DEFAULT_METHOD_KEY
The method key, if present, to use if other specified method keys do not match a request parameter.- See Also:
-
-
Constructor Details
-
AbstractEventMappingDispatcher
Constructs a new dispatcher with the specified method resolver.- Parameters:
methodResolver- the method resolver
-
-
Method Details
-
isSubmissionParameter
Determines whether the specified method key is a submission parameter.- Parameters:
context- the current action contextmethodKey- the method key- Returns:
trueif match; otherwisefalse- See Also:
-
resolveMethodName
Description copied from class:AbstractMappingDispatcherResolves the method name by obtaining theparameterattribute from theActionMapping.- Overrides:
resolveMethodNamein classAbstractMappingDispatcher- Parameters:
context- the current action context- Returns:
- the parameter attribute value
-