⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 action.html

📁 struts api,学习使用struts必备的文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!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  Action
</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>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Action.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../org/apache/struts/action/ActionError.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>  &nbsp;
&nbsp;<A HREF="Action.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<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  Action</H2>
<PRE>
java.lang.Object
  |
  +--<B>org.apache.struts.action.Action</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/struts/tiles/actions/DefinitionDispatcherAction.html">DefinitionDispatcherAction</A>, <A HREF="../../../../org/apache/struts/actions/DispatchAction.html">DispatchAction</A>, <A HREF="../../../../org/apache/struts/actions/DownloadAction.html">DownloadAction</A>, <A HREF="../../../../org/apache/struts/actions/ForwardAction.html">ForwardAction</A>, <A HREF="../../../../org/apache/struts/actions/IncludeAction.html">IncludeAction</A>, <A HREF="../../../../org/apache/struts/actions/LocaleAction.html">LocaleAction</A>, <A HREF="../../../../org/apache/struts/tiles/actions/ReloadDefinitionsAction.html">ReloadDefinitionsAction</A>, <A HREF="../../../../org/apache/struts/actions/SwitchAction.html">SwitchAction</A>, <A HREF="../../../../org/apache/struts/tiles/actions/TilesAction.html">TilesAction</A>, <A HREF="../../../../org/apache/struts/tiles/actions/ViewDefinitionsAction.html">ViewDefinitionsAction</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B>Action</B><DT>extends java.lang.Object</DL>

<P>
<p>An <strong>Action</strong> is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request. The controller (RequestProcessor) will select an appropriate Action for each request, create an instance (if necessary), and call the <code>execute</code> method.</p> <p>Actions must be programmed in a thread-safe manner, because the controller will share the same instance for multiple simultaneous requests. This means you should design with the following items in mind: </p> <ul> <li>Instance and static variables MUST NOT be used to store information     related to the state of a particular request. They MAY be used to     share global resources across requests for the same action.</li> <li>Access to other resources (JavaBeans, session variables, etc.) MUST     be synchronized if those resources require protection. (Generally,     however, resource classes should be designed to provide their own     protection where necessary.</li> </ul> <p>When an <code>Action</code> instance is first created, the controller will call <code>setServlet</code> with a non-null argument to identify the servlet instance to which this Action is attached. When the servlet is to be shut down (or restarted), the <code>setServlet</code> method will be called with a <code>null</code> argument, which can be used to clean up any allocated resources in use by this Action.</p>
<P>
<DL>
<DT><B>Version: </B><DD>$Rev: 164530 $ $Date: 2005-04-25 04:11:07 +0100 (Mon, 25 Apr 2005) $</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 static&nbsp;java.util.Locale</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#defaultLocale">defaultLocale</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use Locale.getDefault directly.  This will be removed after Struts 1.2.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../org/apache/struts/action/ActionServlet.html">ActionServlet</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#servlet">servlet</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The servlet to which we are attached.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static&nbsp;<A HREF="../../../../org/apache/struts/util/TokenProcessor.html">TokenProcessor</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#token">token</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An instance of <code>TokenProcessor</code> to use for token functionality.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== 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/action/Action.html#Action()">Action</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== 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>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#addErrors(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionMessages)">addErrors</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,          <A HREF="../../../../org/apache/struts/action/ActionMessages.html">ActionMessages</A>&nbsp;errors)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds the specified errors keys into the appropriate request attribute for use by the &lt;html:errors&gt; tag, if any messages are required.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#addMessages(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionMessages)">addMessages</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,            <A HREF="../../../../org/apache/struts/action/ActionMessages.html">ActionMessages</A>&nbsp;messages)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds the specified messages keys into the appropriate request attribute for use by the &lt;html:messages&gt; tag (if messages="true" is set), if any messages are required.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/struts/action/ActionForward.html">ActionForward</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.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>&nbsp;mapping,        <A HREF="../../../../org/apache/struts/action/ActionForm.html">ActionForm</A>&nbsp;form,        javax.servlet.http.HttpServletRequest&nbsp;request,        javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it), with provision for handling exceptions thrown by the business logic.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/struts/action/ActionForward.html">ActionForward</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.ServletRequest, javax.servlet.ServletResponse)">execute</A></B>(<A HREF="../../../../org/apache/struts/action/ActionMapping.html">ActionMapping</A>&nbsp;mapping,        <A HREF="../../../../org/apache/struts/action/ActionForm.html">ActionForm</A>&nbsp;form,        javax.servlet.ServletRequest&nbsp;request,        javax.servlet.ServletResponse&nbsp;response)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Process the specified non-HTTP request, and create the corresponding non-HTTP response (or forward to another web component that will create it), with provision for handling exceptions thrown by the business logic.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#generateToken(javax.servlet.http.HttpServletRequest)">generateToken</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Generate a new transaction token, to be used for enforcing a single request for a particular transaction.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;javax.sql.DataSource</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/action/Action.html#getDataSource(javax.servlet.http.HttpServletRequest)">getDataSource</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request)</CODE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -