📄 mappingdispatchaction.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Mar 09 15:31:22 GMT 2006 -->
<TITLE>
Apache Struts API Documentation: Class MappingDispatchAction
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MappingDispatchAction.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/apache/struts/actions/LookupDispatchAction.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/struts/actions/RedeployableActionServlet.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="MappingDispatchAction.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.struts.actions</FONT>
<BR>
Class MappingDispatchAction</H2>
<PRE>
java.lang.Object
|
+--<A HREF="../../../../org/apache/struts/action/Action.html">org.apache.struts.action.Action</A>
|
+--<A HREF="../../../../org/apache/struts/actions/DispatchAction.html">org.apache.struts.actions.DispatchAction</A>
|
+--<B>org.apache.struts.actions.MappingDispatchAction</B>
</PRE>
<HR>
<DL>
<DT>public class <B>MappingDispatchAction</B><DT>extends <A HREF="../../../../org/apache/struts/actions/DispatchAction.html">DispatchAction</A></DL>
<P>
<p>An abstract <strong>Action</strong> that dispatches to a public method that is named by the <code>parameter</code> attribute of the corresponding ActionMapping. This is useful for developers who prefer to combine many related actions into a single Action class.</p> <p>To configure the use of this action in your <code>struts-config.xml</code> file, create an entry like this:</p> <pre><code> <action path="/saveSubscription" type="org.example.SubscriptionAction" name="subscriptionForm" scope="request" input="/subscription.jsp" parameter="method"/> </code></pre> <p>where 'method' is the name of a method in your subclass of MappingDispatchAction that has the same signature (other than method name) of the standard Action.execute method. For example, you might combine the methods for managing a subscription into a single MappingDispatchAction class using the following methods:</p> <ul> <li>public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception</li> <li>public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception</li> <li>public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception</li> <li>public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception</li> <li>public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception</li> </ul> <p>for which you would create corresponding <action> configurations that reference this class:</p> <pre><code> <action path="/createSubscription" type="org.example.SubscriptionAction" parameter="create"> <forward name="success" path="/editSubscription.jsp"/> </action> <action path="/editSubscription" type="org.example.SubscriptionAction" parameter="edit"> <forward name="success" path="/editSubscription.jsp"/> </action> <action path="/saveSubscription" type="org.example.SubscriptionAction" parameter="save" name="subscriptionForm" validate="true" input="/editSubscription.jsp" scope="request"> <forward name="success" path="/savedSubscription.jsp"/> </action> <action path="/deleteSubscription" type="org.example.SubscriptionAction" name="subscriptionForm" scope="request" input="/subscription.jsp" parameter="delete"> <forward name="success" path="/deletedSubscription.jsp"/> </action> <action path="/listSubscriptions" type="org.example.SubscriptionAction" parameter="list"> <forward name="success" path="/subscriptionList.jsp"/> </action> </code></pre> <p><strong>NOTE</strong> - Unlike DispatchAction, mapping characteristics may differ between the various handlers, so you can combine actions in the same class that, for example, differ in their use of forms or validation. Also, a request parameter, which would be visible to the application user, is not required to enable selection of the handler method. </p>
<P>
<DL>
<DT><B>Since: </B><DD>Struts 1.2</DD>
<DT><B>Version: </B><DD>$Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $</DD>
</DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static org.apache.commons.logging.Log</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/MappingDispatchAction.html#log">log</A></B></CODE>
<BR>
Commons Logging instance.</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_org.apache.struts.actions.DispatchAction"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class org.apache.struts.actions.<A HREF="../../../../org/apache/struts/actions/DispatchAction.html">DispatchAction</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/struts/actions/DispatchAction.html#clazz">clazz</A>, <A HREF="../../../../org/apache/struts/actions/DispatchAction.html#messages">messages</A>, <A HREF="../../../../org/apache/struts/actions/DispatchAction.html#methods">methods</A>, <A HREF="../../../../org/apache/struts/actions/DispatchAction.html#types">types</A></CODE></TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_org.apache.struts.action.Action"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class org.apache.struts.action.<A HREF="../../../../org/apache/struts/action/Action.html">Action</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/struts/action/Action.html#defaultLocale">defaultLocale</A>, <A HREF="../../../../org/apache/struts/action/Action.html#servlet">servlet</A>, <A HREF="../../../../org/apache/struts/action/Action.html#token">token</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/MappingDispatchAction.html#MappingDispatchAction()">MappingDispatchAction</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -