📄 actiondispatcher.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 ActionDispatcher
</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/ActionDispatcher.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">
PREV CLASS
<A HREF="../../../../org/apache/struts/actions/DispatchAction.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="ActionDispatcher.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 ActionDispatcher</H2>
<PRE>
java.lang.Object
|
+--<B>org.apache.struts.actions.ActionDispatcher</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/struts/actions/EventActionDispatcher.html">EventActionDispatcher</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B>ActionDispatcher</B><DT>extends java.lang.Object</DL>
<P>
<p>Action <i>helper</i> class that dispatches to a public method in an Action.</p> <p/> <p>This class is provided as an alternative mechanism to using DispatchAction and its various flavours and means <i>Dispatch</i> behaviour can be easily implemented into any <code>Action</code> without having to inherit from a particular super <code>Action</code>.</p> <p/> <p>To implement <i>dispatch</i> behaviour</i> 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 ActionDispatcher(this, ActionDispatcher.MAPPING_FLAVOR); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return dispatcher.execute(mapping, form, request, response); } } </pre> <p/> <p>It provides three flavours of determing the name of the method:</p> <p/> <ul> <li><strong><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#DEFAULT_FLAVOR"><CODE>DEFAULT_FLAVOR</CODE></A></strong> - uses the parameter specified in the struts-config.xml to get the method name from the Request (equivalent to <code>DispatchAction</code> <b>except</b> uses "method" as a default if the <code>parameter</code> is not specified in the struts-config.xml).</li> <p/> <li><strong><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#DISPATCH_FLAVOR"><CODE>DISPATCH_FLAVOR</CODE></A></strong> - uses the parameter specified in the struts-config.xml to get the method name from the Request (equivalent to <code>DispatchAction</code>).</li> <p/> <li><strong><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#MAPPING_FLAVOR"><CODE>MAPPING_FLAVOR</CODE></A></strong> - uses the parameter specified in the struts-config.xml as the method name (equivalent to <code>MappingDispatchAction</code>).</li> <p/> </ul>
<P>
<DL>
<DT><B>Since: </B><DD>Struts 1.2.7</DD>
<DT><B>Version: </B><DD>$Revision: 383720 $ $Date: 2006-03-07 00:07:59 +0000 (Tue, 07 Mar 2006) $</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>protected <A HREF="../../../../org/apache/struts/action/Action.html">Action</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#actionInstance">actionInstance</A></B></CODE>
<BR>
The associated Action to dispatch to.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.Class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#clazz">clazz</A></B></CODE>
<BR>
The Class instance of this <code>DispatchAction</code> class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#DEFAULT_FLAVOR">DEFAULT_FLAVOR</A></B></CODE>
<BR>
Indicates "default" dispatch flavor</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#DISPATCH_FLAVOR">DISPATCH_FLAVOR</A></B></CODE>
<BR>
Indicates flavor compatible with DispatchAction</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#flavor">flavor</A></B></CODE>
<BR>
Indicates dispatch <i>flavor</i></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static org.apache.commons.logging.Log</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#log">log</A></B></CODE>
<BR>
Commons Logging instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#MAPPING_FLAVOR">MAPPING_FLAVOR</A></B></CODE>
<BR>
Indicates "mapping" dispatch flavor</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static <A HREF="../../../../org/apache/struts/util/MessageResources.html">MessageResources</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#messages">messages</A></B></CODE>
<BR>
The message resources for this package.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.util.HashMap</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#methods">methods</A></B></CODE>
<BR>
The set of Method objects we have introspected for this class, keyed by method name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.Class[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/ActionDispatcher.html#types">types</A></B></CODE>
<BR>
The set of argument type classes for the reflected method call.</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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -