📄 actionservlet.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 ActionServlet
</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/ActionServlet.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/action/ActionRedirect.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/struts/action/ActionServletWrapper.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="ActionServlet.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.action</FONT>
<BR>
Class ActionServlet</H2>
<PRE>
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--<B>org.apache.struts.action.ActionServlet</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig</DD>
</DL>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/struts/actions/RedeployableActionServlet.html">RedeployableActionServlet</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B>ActionServlet</B><DT>extends javax.servlet.http.HttpServlet</DL>
<P>
<p><strong>ActionServlet</strong> provides the "controller" in the Model-View-Controller (MVC) design pattern for web applications that is commonly known as "Model 2". This nomenclature originated with a description in the JavaServerPages Specification, version 0.92, and has persisted ever since (in the absence of a better name).</p> <p>Generally, a "Model 2" application is architected as follows:</p> <ul> <li>The user interface will generally be created with server pages, which will not themselves contain any business logic. These pages represent the "view" component of an MVC architecture.</li> <li>Forms and hyperlinks in the user interface that require business logic to be executed will be submitted to a request URI that is mapped to this servlet.</li> <li>There can be <b>one</b> instance of this servlet class, which receives and processes all requests that change the state of a user's interaction with the application. The servlet delegates the handling of a request to a <A HREF="../../../../org/apache/struts/action/RequestProcessor.html"><CODE>RequestProcessor</CODE></A> object. This component represents the "controller" component of an MVC architecture.</li> <li>The <code>RequestProcessor</code> selects and invokes an <A HREF="../../../../org/apache/struts/action/Action.html"><CODE>Action</CODE></A> class to perform the requested business logic, or delegates the response to another resource.</li> <li>The <code>Action</code> classes can manipulate the state of the application's interaction with the user, typically by creating or modifying JavaBeans that are stored as request or session attributes (depending on how long they need to be available). Such JavaBeans represent the "model" component of an MVC architecture.</li> <li>Instead of producing the next page of the user interface directly, <code>Action</code> classes generally return an <A HREF="../../../../org/apache/struts/action/ActionForward.html"><CODE>ActionForward</CODE></A> to indicate which resource should handle the response. If the <code>Action</code> does not return null, the <code>RequestProcessor</code> forwards or redirects to the specified resource (by utilizing <code>RequestDispatcher.forward</code> or <code>Response.sendRedirect</code>) so as to produce the next page of the user interface.</li> </ul> <p>The standard version of <code>RequestsProcessor</code> implements the following logic for each incoming HTTP request. You can override some or all of this functionality by subclassing this object and implementing your own version of the processing.</p> <ul> <li>Identify, from the incoming request URI, the substring that will be used to select an action procedure.</li> <li>Use this substring to map to the Java class name of the corresponding action class (an implementation of the <code>Action</code> interface). </li> <li>If this is the first request for a particular <code>Action</code> class, instantiate an instance of that class and cache it for future use.</li> <li>Optionally populate the properties of an <code>ActionForm</code> bean associated with this mapping.</li> <li>Call the <code>execute</code> method of this <code>Action</code> class, passing on a reference to the mapping that was used, the relevant form-bean (if any), and the request and the response that were passed to the controller by the servlet container (thereby providing access to any specialized properties of the mapping itself as well as to the ServletContext). </li> </ul> <p>The standard version of <code>ActionServlet</code> is configured based on the following servlet initialization parameters, which you will specify in the web application deployment descriptor (<code>/WEB-INF/web.xml</code>) for your application. Subclasses that specialize this servlet are free to define additional initialization parameters. </p> <ul> <li><strong>config</strong> - Comma-separated list of context-relative path(s) to the XML resource(s) containing the configuration information for the default module. (Multiple files support since Struts 1.1) [/WEB-INF/struts-config.xml].</li> <li><strong>config/${module}</strong> - Comma-separated list of Context-relative path(s) to the XML resource(s) containing the configuration information for the module that will use the specified prefix (/${module}). This can be repeated as many times as required for multiple modules. (Since Struts 1.1)</li> <li><strong>configFactory</strong> - The Java class name of the <code>ModuleConfigFactory</code> used to create the implementation of the <code>ModuleConfig</code> interface. [org.apache.struts.config.impl.DefaultModuleConfigFactory] </li> <li><strong>convertNull</strong> - Force simulation of the Struts 1.0 behavior when populating forms. If set to true, the numeric Java wrapper class types (like <code>java.lang.Integer</code>) will default to null (rather than 0). (Since Struts 1.1) [false] </li> <li><strong>rulesets</strong> - Comma-delimited list of fully qualified classnames of additional <code>org.apache.commons.digester.RuleSet</code> instances that should be added to the <code>Digester</code> that will be processing <code>struts-config.xml</code> files. By default, only the <code>RuleSet</code> for the standard configuration elements is loaded. (Since Struts 1.1)</li> <li><strong>validating</strong> - Should we use a validating XML parser to process the configuration file (strongly recommended)? [true]</li> </ul>
<P>
<DL>
<DT><B>Version: </B><DD>$Rev: 264684 $ $Date: 2005-08-30 04:08:01 +0100 (Tue, 30 Aug 2005) $</DD>
<DT><B>See Also: </B><DD><A HREF="../../../../serialized-form.html#org.apache.struts.action.ActionServlet">Serialized Form</A></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 java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#config">config</A></B></CODE>
<BR>
Comma-separated list of context-relative path(s) to our configuration resource(s) for the default module.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected org.apache.commons.digester.Digester</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#configDigester">configDigester</A></B></CODE>
<BR>
The Digester used to produce ModuleConfig objects from a Struts configuration file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#convertNull">convertNull</A></B></CODE>
<BR>
The flag to request backwards-compatible conversions for form bean properties of the Java wrapper class types.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected org.apache.commons.collections.FastHashMap</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#dataSources">dataSources</A></B></CODE>
<BR>
The JDBC data sources that has been configured for this module, if any, keyed by the servlet context attribute under which they are stored.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../org/apache/struts/util/MessageResources.html">MessageResources</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#internal">internal</A></B></CODE>
<BR>
The resources object for our internal resources.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#internalName">internalName</A></B></CODE>
<BR>
The Java base name of our internal resources.</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/action/ActionServlet.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>protected <A HREF="../../../../org/apache/struts/action/RequestProcessor.html">RequestProcessor</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#processor">processor</A></B></CODE>
<BR>
The <code>RequestProcessor</code> instance we will use to process all incoming requests.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#registrations">registrations</A></B></CODE>
<BR>
The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#servletMapping">servletMapping</A></B></CODE>
<BR>
The URL pattern to which we are mapped in our web application deployment descriptor.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/ActionServlet.html#servletName">servletName</A></B></CODE>
<BR>
The servlet name under which we are registered in our web application deployment descriptor.</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_javax.servlet.http.HttpServlet"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -