国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
Struts-config.xml配置文件《action-mappings》元素的詳解 -...
Struts-config.xml配置文件《action-mappings》元素的詳解 [轉(zhuǎn)貼 2010-02-03 11:41:34]
 
 
字號(hào):

action-mappings

       該元素用于將Action元素定義到ActionServlet類(lèi)中,它含有0到多個(gè)<action/>元素,其格式如下:

<action-mappings>

<action path="Action請(qǐng)求的相對(duì)路徑,與頁(yè)面<html:form>的Action屬性值一致"

type="該Action的對(duì)應(yīng)類(lèi)的全路徑"

name="該Action綁定的FormBean,與<form-bean >的Name屬性值一致"

<forward name="與Action類(lèi)中mapping.findForward("mapname")返回的mapname值一致" path="頁(yè)面跳轉(zhuǎn)的相對(duì)路徑"/>

</action>

</action-mappings>

       每個(gè)action子元素可包含一個(gè)或多個(gè)forward子元素。除了path、type和name屬性外,action還具有如下屬性:

l         scope:指定ActionForm Bean的作用域(session和request),缺省為session。(可選);

l         input:當(dāng)Bean發(fā)生錯(cuò)誤時(shí)返回的路徑,在validate驗(yàn)證框架中錯(cuò)誤顯示的頁(yè)面(可選);

l         classname:指定一個(gè)調(diào)用這個(gè)Action類(lèi)的ActionMapping類(lèi)的全名。缺省用org.apache.struts.action.ActionMapping(可選);

l         include:如果沒(méi)有forward的時(shí)候,它起forward的作用(可選);

l         validate:若為true,則會(huì)調(diào)用ActionForm的validate()方法或調(diào)用validate驗(yàn)證,否則不調(diào)用,缺省為true(可選)。

forward屬性也是可選的。

action元素定義舉例如下:

Example1.

Eg2. 有input屬性的例子:

<action-mappings>    <action

     path="/userAction"

     type="com.amigo.struts.action.UserAction"

     name="UserForm"

     scope="request"

     validate = "false"

     parameter="method" >

     <forward name="error" path="/user/error.jsp" />

     <forward name="success" path="/user/success.jsp"/>

     <forward name="add" path="/user/addUser.jsp"/>

     <forward name="update" path="/user/updateUser.jsp"/>

     <forward name="list" path="/user/userList.jsp"/>

    </action>

</action-mappings>

Eg3. 僅有JSP的action元素:

<action-mappings>

    <action path="/calcAction"

    type="com.amigo.struts.action.CalcAction"

    name="CalcForm"

    scope="request"

    validate="true"

    input="/index.jsp">

    <forward name="success" path="/success.jsp"/>
    <forward name="error" path="/error.jsp"/>

    </action>

</action-mappings>

首先,ActionServlet接到請(qǐng)求后調(diào)用ForwardAction的execute()方法,execute()根據(jù)配置的parameter屬性值來(lái)forward到那個(gè)URI。

<action path="/menu"

    parameter="/default.jsp"

    type="org.apache.struts.actions.ForwardAction" />

這樣做的效果是:沒(méi)有任何form被實(shí)例化,比較現(xiàn)實(shí)的情形可能是form在request更高級(jí)別的范圍中定義;或者這個(gè)action被用作在應(yīng)用程序編譯好后充當(dāng)系統(tǒng)參數(shù),只需要更改這個(gè)配置文件而不需要重新編譯系統(tǒng)。


本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/zhoukang0916/archive/2009/05/23/4210029.aspx

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
structs中基本配置入門(mén)
Struts的配置文件
Struts-config.xml配置文件講解
struts1 Action原理與配置
struts1配置文件中action的常用屬性
再說(shuō)Struts多模塊開(kāi)發(fā)
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服