`

<action parameter="method" />

 
阅读更多
<action parameter="method"/>



structs-config.xml里<action parameter="method">


表单: <html:form action="/myTest.do?actions=insert" method="post">.
超链接:<a herf="myTest.do?actions=insert"">do_insert</a>

struts-config.xml里:
  <action name="frameTestForm" path="/frameTest" scope="request"
   parameter="actions" validate="true">
   //最上面的actions就是这个parameter的值,再又DispatchAction调用insert()
  ...... 
  </action>

这个是Struts的DispatchAction机制,
简单描述:
一个Action通常只能完成一种业务操作,如果你想在一个Action里处理多个业务请求,那么可以使用DispatchAction。
parameter是制定的action类里的方法:
1.一个action有多个方法,然后这里配置<action parameter="your_method">
2.一个action只有一个execute方法,这里就不用配置parameter,默认是execute。

原理:
<action>的parameter属性是给DispatchAction使用的,你的类要继承DispatchAction类,而不是普通的Action,Action只会执行execute方法,DispatchAction会根据parameter的值执行特定的方法,注意parameter的值不要设置为execute,也不要覆盖DispatchAction中的execute(),因为DispatchAction继承于Action,它的execute会首先执行,在execute()方法中取出parameter的值,通过java反射调用指定的方法。
分享到:
评论

相关推荐

    FCKeditor-test

    string)&gt;selected="selected"&lt;/#if&gt;&gt;${(item.parametername)?default("")}&lt;/option&gt; &lt;/#list&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="list_box1_title2"&gt;是否可用:&nbsp;&nbsp;&lt;/td&gt; &lt;td&gt; &lt;input type=...

    《ASP交互网页设计篇》书中源代码

    &lt;%@language=vbscript codepage=936 %&gt; &lt;% option explicit response.buffer=true %&gt; &lt;!--#include file="Connections/connSoft.asp" --&gt; &lt;% Dim Rs1__MMColParam Rs1__MMColParam = "False" If (Request("MM_Empty...

    springmybatis

    查询出列表,也就是返回list, 在我们这个例子中也就是 List&lt;User&gt; , 这种方式返回数据,需要在User.xml 里面配置返回的类型 resultMap, 注意不是 resultType, 而这个resultMap 所对应的应该是我们自己配置的 ...

    Myeclipse开发struts+hibernate+spring新手入门--环境配置---项目开发示例

    21 &lt;message-resources parameter="ApplicationResources" /&gt; 22 &lt;/struts-config&gt; 对应生成的formbean如下代码所示: 1 import javax.servlet.http.HttpServletRequest; 2 import org.apache.struts.action....

    ssh(structs,spring,hibernate)框架中的上传下载

    4. destroy-method="close"> 5. <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> 6. <property name="url" value="jdbc:oracle:thin:@localhost:1521:ora9i"/> 7. <property ...

    VB编程资源大全(英文源码 其它)

    in "random number table....)&lt;END&gt;&lt;br&gt;37,rptparam.zip&lt;br&gt;This program generates datareport with two parameter values set during runtime - using dataenvironment and Microsoft Jet.OLEDB 3.51&lt;END&gt;&lt;br&gt;38,...

    ASP.NET无刷新上传.rar

    &lt;script&gt; var QuickUpload = function(file, options) { this.file = $$(file); this._sending = false;//是否正在上传 this._timer = null;//定时器 this._iframe = null;//iframe对象 this._...

    Delphi7.1 Update

    Cannot access field &lt;fieldname&gt; as type variant.&quot; * TClientDataSet doesn‘t save data to file when FileName is set and there is no existing file on disk (Quality Central 2307). * Using the Delphi...

    asp.net mvc

    Every property or method argument that accepted IDictionary&lt;string, ValueProviderResult&gt; now accepts IValueProvider. This change affects only applications that include custom value providers or ...

    Java邮件开发Fundamentals of the JavaMail API

    Fundamentals of the JavaMail API Presented by developerWorks, your source for great tutorials ... Table of Contents If you're viewing this document online, you can click any of the topics below ...

    JSP Simple Examples

    &lt;jsp:include page = " "&gt;:- This is known as the include standard action. This standard action is used to include a file at run time. This standard action is evaluated at the run time. Snoop in JSP ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - ADD: Add TFlexPanel.InvalidateControl virtual method which calls from TFlexControl.Invalidate and can be overriden (it is possible now to catch all object invalidation calls). - FIX: The TFlexPanel....

    php.ini-development

    Allow ASP-style &lt;% %&gt; tags. ; http://php.net/asp-tags asp_tags = Off ; The number of significant digits displayed in floating point numbers. ; http://php.net/precision precision = 14 ; Output ...

    ImpREC 1.7c

    - Support relative calls rebuild =&gt; visible with a (R) tag in imports - Fixed a bug with "Create New IAT". It can now manage a thunk which has several apis of different module (Thanks to EOD) - ...

    二级减速器课程设计说明书reducer design specification.doc

    二级减速器课程设计说明书,全英文书写 《Machine Parts Design》 Design Specification ...Topic Designation of Reducer College College of Mechanical and Electrical Engineering Major Mechanical ...

    org.springframework.web.servlet-3.0.1.RELEASE-A.jar

    Invalid property 'error_view' of bean class [com.demo.controller.action.AuthorAction]: Bean property 'error_view' is not writable or has an invalid setter method. Does the parameter type of the ...

    Fuzzy Control Systems

    6 Integral Action 7 Relationship to Fuzzy Logic Control References Chapter 12—Synthesis of Nonlinear Controllers via Fuzzy Logic 1 Introduction 2 Fuzzy Control Systems 2.1 Control ...

    BURNINTEST--硬件检测工具

    &lt;For more details see the online help&gt; Status ====== This is a shareware program. This means that you need to buy it if you would like to continue using it after the evaluation period. Installation...

    Oracle P/L SQL实现发送Email、浏览网页等网络操作功能

    --Exec UTL_INet.p_PutClob2File( as_FileName =&gt; 'aa.sql', ac_Text =&gt; 'test sql' ); Procedure p_PutClob2File( as_SubDir in VarChar2, --目录名 as_FileName in VarChar2, --文件名 ...

    BCGControlBarPro.v12.00

    CBCGPRibbonStatusBarPane constructor and SetAnimationList method have a new optional parameter 'BOOL bDontScaleInHighDPIMode'. Set it to TRUE if you don't need to scale pane image in the High DPI mode...

Global site tag (gtag.js) - Google Analytics