Class ServletMappingDispatcher
java.lang.Object
org.apache.struts.dispatcher.AbstractDispatcher
org.apache.struts.dispatcher.AbstractMappingDispatcher
org.apache.struts.dispatcher.servlet.ServletMappingDispatcher
- All Implemented Interfaces:
Serializable
,Dispatcher
This servlet-based dispatcher uses the configuration value of the
parameter
attribute from the corresponding
ActionMapping
to pick the appropriate method
on the action. Because mapping characteristics may differ between the various
handlers, actions can be combined in the same class that, differ in their use
of method signatures, forms, and/or validation.
For example, a single action may manage a subscription process by defining the following methods:
public void create(ActionContext context)
public void delete(ActionContext context)
public String edit(ActionContext context)
public ActionForward list(ActionContext context)
public String save(ActionContext context)
<action path="/createSubscription"
type="org.example.SubscriptionAction"
dispatcher="org.apache.struts.dispatcher.servlet.ServletMappingDispatcher"
parameter="create">
<forward path="/editSubscription.jsp"/>
</action>
<action path="/deleteSubscription"
type="org.example.SubscriptionAction"
dispatcher="org.apache.struts.dispatcher.servlet.ServletMappingDispatcher"
parameter="delete"
name="subscriptionForm"
scope="request">
<forward path="/deletedSubscription.jsp"/>
<forward name="input" path="/subscription.jsp"
</action>
<action path="/editSubscription"
type="org.example.SubscriptionAction"
dispatcher="org.apache.struts.dispatcher.servlet.ServletMappingDispatcher"
parameter="edit">
<forward path="/editSubscription.jsp"/>
</action>
<action path="/listSubscriptions"
type="org.example.SubscriptionAction"
dispatcher="org.apache.struts.dispatcher.servlet.ServletMappingDispatcher"
parameter="list">
<forward path="/subscriptionList.jsp"/>
</action>
<action path="/saveSubscription"
type="org.example.SubscriptionAction"
dispatcher="org.apache.struts.dispatcher.servlet.ServletMappingDispatcher"
parameter="save"
name="subscriptionForm"
scope="request"
validate="true">
<forward path="/savedSubscription.jsp"/>
<forward name="input" path="/editSubscription.jsp"
</action>
- Since:
- Struts 1.4
- Version:
- $Rev$
- See Also:
-
Field Summary
Fields inherited from class org.apache.struts.dispatcher.AbstractDispatcher
CANCELLED_METHOD_NAME, EXECUTE_METHOD_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
unspecified
(ActionContext context) Sends the 404 HTTP error response.Methods inherited from class org.apache.struts.dispatcher.AbstractMappingDispatcher
getDefaultMappingParameter, resolveMethodName, setDefaultMappingParameter
Methods inherited from class org.apache.struts.dispatcher.AbstractDispatcher
dispatch, dispatchMethod, getDefaultMethodName, getMethod, invoke, isCancelled
-
Constructor Details
-
ServletMappingDispatcher
public ServletMappingDispatcher()Constructs a new servlet mapping dispatcher.
-
-
Method Details
-
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 an error occurs- See Also:
-