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

📄 scriptaction.html

📁 框架结构,适用一些初学者使用. 请先压缩再使用
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_01) on Sat Dec 17 12:23:10 PST 2005 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>ScriptAction (Struts Scripting 1.0.1 API)</TITLE><META NAME="keywords" CONTENT="org.apache.struts.scripting.ScriptAction class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="ScriptAction (Struts Scripting 1.0.1 API)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../org/apache/struts/scripting/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/ScriptAction.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;<A HREF="../../../../org/apache/struts/scripting/RequestToVariableFilter.html" title="class in org.apache.struts.scripting"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../org/apache/struts/scripting/StrutsInfo.html" title="class in org.apache.struts.scripting"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../../index.html?org/apache/struts/scripting/ScriptAction.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="ScriptAction.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&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><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.apache.struts.scripting</FONT><BR>Class ScriptAction</H2><PRE>java.lang.Object  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">org.apache.struts.action.Action      <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.struts.scripting.ScriptAction</B></PRE><HR><DL><DT><PRE>public class <B>ScriptAction</B><DT>extends org.apache.struts.action.Action</DL></PRE><P>This Action uses scripts to perform its action. The scripting framework is  Apache's Bean Scripting Framework which allows the scripts to be written  many of the popular scripting languages including JavaScript, Perl, Python,  and even VBA. <br />  <br />  To determine what script will be executed, the "parameter" attribute of the  action mapping should contain the name of the script relative to the web  application root directory (i.e. http://server/app). <br />  <br />  Before the script completes, the next ActionForward needs to be specified.  This can be done one of two ways:  <ol>    <li> Set <code>struts.forwardName</code> to the name of the forward</li>    <li> Set <code>struts.forward</code> to the actual ActionForward object    </li>  </ol>  A number of pre-defined variables are available to the script:  <ul>    <li> <code>request</code> - The HTTP request</li>    <li> <code>response</code> - The HTTP response</li>    <li> <code>session</code> - The session</li>    <li> <code>application</code> - The servlet context</li>    <li> <code>struts</code> - A grouping of all Struts-related objects</li>    <li> <code>log</code> - A logging instance</li>  </ul>  You can add your own variables by creating a BSFManagerFilter and  configuring it in struts-scripting.properties:  <ul>    <li> <code>struts-scripting.filters.FILTER_NAME.class=FILTER_CLASS</code>    - The class implementing BSFManagerFilter where FILTER_NAME is the name    you are calling the filter.</li>    <li> <code>     struts-scripting.filters.FILTER_NAME.PROPERTY_NAME=PROPERTY_VALUE      </code> - A property to be used by the filter.</li>  </ul>  <br />  <br />  To use other scripting engines other than BeanShell, create a file called  <code>struts-scripting.properties</code> and add two properties for each  engine:  <ul>    <li> <code>struts-scripting.engine.ENGINE_NAME.class</code> - The class of    the BSF engine where ENGINE_NAME is the name you are calling the engine.    </li>    <li> <code>struts-scripting.engine.ENGINE_NAME.extensions</code> - A    comma-delimited list of file extensions that will be used to identify the    engine to use to execute the script.</li>  </ul>  This code was originally based off code from JPublish, but has since been  almost completely rewritten.<P><P><HR><P><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Field Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#ENGINE_BASE">ENGINE_BASE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The base property for alternate BSF engines.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#FILTERS_BASE">FILTERS_BASE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The base property for classes that put new variables in the context.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static&nbsp;org.apache.commons.logging.Log</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#LOG">LOG</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The logging instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#PROPS_PATH">PROPS_PATH</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The default path to the properties file.</TD></TR></TABLE>&nbsp;<A NAME="fields_inherited_from_class_org.apache.struts.action.Action"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Fields inherited from class org.apache.struts.action.Action</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>defaultLocale, servlet</CODE></TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#ScriptAction()">ScriptAction</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" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;org.apache.struts.action.ActionForward</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">execute</A></B>(org.apache.struts.action.ActionMapping&nbsp;mapping,        org.apache.struts.action.ActionForm&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;Executes the script.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;java.util.Locale</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#getLocale(javax.servlet.http.HttpServletRequest)">getLocale</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the locale.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#isCancelled(javax.servlet.http.HttpServletRequest)">isCancelled</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks to see if the request is cancelled.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#isTokenValid(javax.servlet.http.HttpServletRequest)">isTokenValid</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks to see if the token is valid.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static&nbsp;<A HREF="../../../../org/apache/struts/scripting/BSFManagerFilter.html" title="interface in org.apache.struts.scripting">BSFManagerFilter</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#loadFilters(java.util.Properties)">loadFilters</A></B>(java.util.Properties&nbsp;props)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loads and initializes the filters.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;org.apache.struts.scripting.ScriptAction.Script</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#loadScript(java.lang.String, javax.servlet.ServletContext)">loadScript</A></B>(java.lang.String&nbsp;name,           javax.servlet.ServletContext&nbsp;context)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loads the script from cache if possible.</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/scripting/ScriptAction.html#parseScriptName(java.lang.String, org.apache.bsf.BSFManager)">parseScriptName</A></B>(java.lang.String&nbsp;url,                org.apache.bsf.BSFManager&nbsp;manager)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parses the script name and puts any url parameters in the context.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#resetToken(javax.servlet.http.HttpServletRequest)">resetToken</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resets the token.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#saveErrors(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionErrors)">saveErrors</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req,           org.apache.struts.action.ActionErrors&nbsp;errs)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use saveErrors(HttpServletRequest, ActionMessages) instead.      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>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#saveMessages(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionMessages)">saveMessages</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req,             org.apache.struts.action.ActionMessages&nbsp;mes)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Saves the messages to the request.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#saveToken(javax.servlet.http.HttpServletRequest)">saveToken</A></B>(javax.servlet.http.HttpServletRequest&nbsp;req)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Saves a token.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static&nbsp;java.lang.String[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/apache/struts/scripting/ScriptAction.html#split(java.lang.String, java.lang.String)">split</A></B>(java.lang.String&nbsp;line,      java.lang.String&nbsp;delimiter)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Splits a line with the given delimiter.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_org.apache.struts.action.Action"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class org.apache.struts.action.Action</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getMessages, getResources, getResources, getServlet, isTokenValid, saveErrors, saveErrors, saveMessages, setLocale, setServlet</CODE></TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR>

⌨️ 快捷键说明

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