Class ServletParameterDispatcher
java.lang.Object
org.apache.struts.dispatcher.AbstractDispatcher
org.apache.struts.dispatcher.AbstractParameterDispatcher
org.apache.struts.dispatcher.servlet.ServletParameterDispatcher
- All Implemented Interfaces:
Serializable
,Dispatcher
This servlet-based dispatcher uses the value of the request parameter to pick
the appropriate method on the action.
To configure the use of this dispatcher in your configuration, create an entry like below:
<action path="/saveSubscription"
type="org.example.SubscriptionAction"
dispatcher="org.apache.struts.dispatcher.servlet.ServletParameterDispatcher"
parameter="method"/>
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
This example will use the value of the request parameter named "method" to pick the appropriate method. For example, you might have the following three methods in the same action:
public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
public void insert(ActionContext context)
public void update(ServletActionContext context)
http://localhost:8080/myapp/saveSubscription.do?method=update
- Since:
- Struts 1.4
- Version:
- $Rev$
- See Also:
-
Field Summary
Fields inherited from class org.apache.struts.dispatcher.AbstractParameterDispatcher
DEFAULT_PARAMETER_NAME
Fields inherited from class org.apache.struts.dispatcher.AbstractDispatcher
CANCELLED_METHOD_NAME, EXECUTE_METHOD_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
resolveParameterValue
(ActionContext context, String parameter) Extracts the value from the specified servlet parameter.protected Object
unspecified
(ActionContext context) Sends the 404 HTTP error response.Methods inherited from class org.apache.struts.dispatcher.AbstractParameterDispatcher
getDefaultParameterName, getParameter, resolveMethodName
Methods inherited from class org.apache.struts.dispatcher.AbstractDispatcher
dispatch, dispatchMethod, getDefaultMethodName, getMethod, invoke, isCancelled
-
Constructor Details
-
ServletParameterDispatcher
public ServletParameterDispatcher()Constructs a new servlet parameter dispatcher.
-
-
Method Details
-
resolveParameterValue
Extracts the value from the specified servlet parameter.- Specified by:
resolveParameterValue
in classAbstractParameterDispatcher
- Parameters:
context
- the current action contextparameter
- the servlet parameter name- Returns:
- the servlet parameter value
-
unspecified
Sends the 404 HTTP error response.- Overrides:
unspecified
in classAbstractDispatcher
- Parameters:
context
- the current action context- Returns:
- always
null
since the response is handled directly - Throws:
Exception
- if the error code fails to set- See Also:
-