📄 eventactiondispatcher.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 EventActionDispatcher
</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/EventActionDispatcher.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/DownloadAction.ResourceStreamInfo.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/struts/actions/EventDispatchAction.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="EventActionDispatcher.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 EventActionDispatcher</H2>
<PRE>
java.lang.Object
|
+--<A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html">org.apache.struts.actions.ActionDispatcher</A>
|
+--<B>org.apache.struts.actions.EventActionDispatcher</B>
</PRE>
<HR>
<DL>
<DT>public class <B>EventActionDispatcher</B><DT>extends <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html">ActionDispatcher</A></DL>
<P>
<p>An Action helper class that dispatches to to one of the public methods that are named in the <code>parameter</code> attribute of the corresponding ActionMapping and 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 class.</p> <p>The method(s) in the associated <code>Action</code> must have the same signature (other than method name) of the standard Action.execute method.</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="save,back,recalc=recalculate,default=save"/> </code></pre> <p>where <code>parameter</code> contains three possible methods and one default method if nothing matches (such as the user pressing the enter key).</p> <p>For utility purposes, you can use the <code>key=value</code> 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 <em>recalc</em> button (via a request parameter) will invoke the <code>recalculate</code> method. The security-minded person may find this feature valuable to obfuscate and not expose the methods.</p> <p>The <em>default</em> key is purely optional. If this is not specified and no parameters match the list of method keys, <code>null</code> is returned which means the <code>unspecified</code> method will be invoked.</p> <p>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.</p> <p>To implement this <i>dispatch</i> behaviour in an <code>Action</code>, class create your custom Action as follows, along with the methods you require (and optionally "cancelled" and "unspecified" methods):</p> <p/> <pre> public class MyCustomAction extends Action { protected ActionDispatcher dispatcher = new EventActionDispatcher(this); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return dispatcher.execute(mapping, form, request, response); } } </pre> <p/>
<P>
<DL>
<DT><B>Since: </B><DD>Struts 1.2.9</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 java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/EventActionDispatcher.html#DEFAULT_METHOD_KEY">DEFAULT_METHOD_KEY</A></B></CODE>
<BR>
The method key, if present, to use if other specified method keys do not match a request parameter.</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/EventActionDispatcher.html#LOG">LOG</A></B></CODE>
<BR>
Commons Logging instance.</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_org.apache.struts.actions.ActionDispatcher"><!-- --></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/ActionDispatcher.html">ActionDispatcher</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#actionInstance">actionInstance</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#clazz">clazz</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#DEFAULT_FLAVOR">DEFAULT_FLAVOR</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#DISPATCH_FLAVOR">DISPATCH_FLAVOR</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#flavor">flavor</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#log">log</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#MAPPING_FLAVOR">MAPPING_FLAVOR</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#messages">messages</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#methods">methods</A>, <A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#types">types</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/EventActionDispatcher.html#EventActionDispatcher(org.apache.struts.action.Action)">EventActionDispatcher</A></B>(<A HREF="../../../../org/apache/struts/action/Action.html">Action</A> action)</CODE>
<BR>
Constructs a new object for the specified action.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -