📄 lookupdispatchaction.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 LookupDispatchAction
</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/LookupDispatchAction.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/LocaleAction.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/struts/actions/MappingDispatchAction.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="LookupDispatchAction.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 LookupDispatchAction</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.LookupDispatchAction</B>
</PRE>
<HR>
<DL>
<DT>public abstract class <B>LookupDispatchAction</B><DT>extends <A HREF="../../../../org/apache/struts/actions/DispatchAction.html">DispatchAction</A></DL>
<P>
<p> An abstract <strong>Action</strong> that dispatches to the subclass mapped <code>execute</code> method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the <code>parameter</code> property of the corresponding ActionMapping. To configure the use of this action in your <code>struts-config.xml</code> file, create an entry like this:</p> <pre> <action path="/test" type="org.example.MyAction" name="MyForm" scope="request" input="/test.jsp" parameter="method"/> </pre> <p> which will use the value of the request parameter named "method" to locate the corresponding key in ApplicationResources. For example, you might have the following ApplicationResources.properties:</p> <pre> button.add=Add Record button.delete=Delete Record </pre><p> And your JSP would have the following format for submit buttons:</p> <pre> <html:form action="/test"> <html:submit property="method"> <bean:message key="button.add"/> </html:submit> <html:submit property="method"> <bean:message key="button.delete"/> </html:submit> </html:form> </pre> <p> Your subclass must implement both getKeyMethodMap and the methods defined in the map. An example of such implementations are:</p> <pre> protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("button.add", "add"); map.put("button.delete", "delete"); return map; } public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // do add return mapping.findForward("success"); } public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // do delete return mapping.findForward("success"); } <p> <strong>Notes</strong> - If duplicate values exist for the keys returned by getKeys, only the first one found will be returned. If no corresponding key is found then an exception will be thrown. You can override the method <code>unspecified</code> to provide a custom handler. If the submit was cancelled (a <code>html:cancel</code> button was pressed), the custom handler <code>cancelled</code> will be used instead.
<P>
<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 java.util.Map</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/LookupDispatchAction.html#keyMethodMap">keyMethodMap</A></B></CODE>
<BR>
Resource key to method name lookup.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.util.Map</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/LookupDispatchAction.html#localeMap">localeMap</A></B></CODE>
<BR>
Reverse lookup map from resource value to resource key.</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/LookupDispatchAction.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#log">log</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/LookupDispatchAction.html#LookupDispatchAction()">LookupDispatchAction</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">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../org/apache/struts/action/ActionForward.html">ActionForward</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/LookupDispatchAction.html#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">execute</A></B>(<A HREF="../../../../org/apache/struts/action/ActionMapping.html">ActionMapping</A> mapping, <A HREF="../../../../org/apache/struts/action/ActionForm.html">ActionForm</A> form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)</CODE>
<BR>
Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected abstract java.util.Map</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/actions/LookupDispatchAction.html#getKeyMethodMap()">getKeyMethodMap</A></B>()</CODE>
<BR>
Provides the mapping from resource key to method name.</TD>
</TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -