<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] # struts.xml配置 **package配置** 1.name屬性 作用:定義一個包的名稱,它必須唯一。 2.namespace屬性 作用:主要是與action標簽的name屬性聯合使用來確定一個action 的訪問路徑 3.extends屬性 作用:指定繼承自哪個包。一般值是strtus-default strtus-default包是在strtus-default.xml文件中聲明的。 4.abstruct屬性 它代表當前包是一個抽象的,主要是用于被繼承 **action配置** 1.name屬性 作用:主要是與package的namespace聯合使用來確定一個action的訪問路 徑 2.class屬性 作用:用于指示當前的action類 3.method屬性 作用:用于指示當前的action類中的哪個方法執行 **result配置** 它主要是用于指示結果視圖 1.name屬性 作用是與action類的method方法的返回值進行匹配,來確定跳轉路徑 2.type屬性 作用是用于指定跳轉方式 **擴展** 關于action配置中的class與method的默認值以及result中的name與type 默認值問題 ![](https://box.kancloud.cn/c5a5e08b97426031bc3defa68f25120d_597x126.png) 它的作用就是當一個請求來時,如果查找不到指定的class及對應的method就會執行 ActionSupport類中的execute方法。 在這個類的execute方法中默認返回的是”success” 也就是說,result的name屬性默認值是success,默認的跳轉方式是請求轉發 dispatcher ![](https://box.kancloud.cn/f765612dbaa514b32014eea9f1eb663e_937x213.png) ![](https://box.kancloud.cn/07f8f5ae5c6be15806b83cd356eeec44_1241x194.png) ![](https://box.kancloud.cn/afe8285e5d6923559860293f37206ed3_1127x237.png) ![](https://box.kancloud.cn/7abc8649b74c1ec611c08362c515ea9c_1079x80.png) # Struts2配置文件加載順序 ![](https://box.kancloud.cn/c28f4c2f10682e0d43cc1416be598060_443x129.png) 第一個加載的是default.properties文件 位置:strtus2-core.jar包 org.apache.struts2包下 作用:主要是聲明了struts2框架的常量 第二個加載的是一批配置文件 Strtus-default.xml 位置:struts2-corl.jar 作用:聲明了interceptor result bean Strtus-plugin.xml 位置:在strtus2的插件包中 作用:主要用于插件的配置聲明 Strtus.xml 位置:在我們自己的工程中 作用:用于我們自己工程使用strtus2框架的配置 第三個加載的是自定義的strtus.properties 位置:都是在自己工程的src下 作用:定制常量 第四自定義配置提供 第五加載的是web.xml配置文件 主要是加載strtus2框架在web.xml文件中的相關配置 第六 bean相關配置 總結 ![](https://box.kancloud.cn/0bb2257d29d92cd4a52d0acdac3a69a4_393x135.png) # 常量配置 default.properties文件中定義了struts2框架常用常量 . ![](https://box.kancloud.cn/dfb7838b3dd3a02f59471ac7f5742063_216x181.png) 問題:我們怎樣可以定義常量 ? 1. 可以在src下創建一個strtus.properties配置文件 2. 可以在web.xml文件中配置 3. 可以直接在strtus.xml文件中定義常量 (推薦) ![](https://box.kancloud.cn/445efd08300ad0ee61df40a9a75e66e1_612x99.png) 注意:后加載的配置文件中的常量會將先加載的常量覆蓋 ![](https://box.kancloud.cn/dfb2881c789f938663134ca490f9d526_531x217.png) # 默認配置 ![](https://box.kancloud.cn/ba7c82dc8359df6245417818659fe505_802x265.png) # 配置文件 struts.xml ~~~ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <!-- i18n:國際化. 解決post提交亂碼 --> <constant name="struts.i18n.encoding" value="UTF-8"></constant> <!-- 指定反問action時的后綴名 http://localhost:8080/w1/hello/HelloAction.do --> <constant name="struts.action.extension" value="action"></constant> <!-- 指定struts2是否以開發模式運行 1.熱加載主配置.(不需要重啟即可生效) 2.提供更多錯誤信息輸出,方便開發時的調試 --> <constant name="struts.devMode" value="true"></constant> <!-- package:將Action配置封裝.就是可以在Package中配置很多action. name屬性: 給包起個名字,起到標識作用.隨便起.不能其他包名重復. namespace屬性:給action的訪問路徑中定義一個命名空間 extends屬性: 繼承一個 指定包 abstract屬性:包是否為抽象的; 標識性屬性.標識該包不能獨立運行.專門被繼承 --> <package name="hello" namespace="/hello" extends="struts-default" > <!-- action元素:配置action類 name屬性: 決定了Action訪問資源名. class屬性: action的完整類名 method屬性: 指定調用Action中的哪個方法來處理請求 --> <action name="HelloAction" class="domain.HelloAction" method="hello" > <!-- result元素:結果配置 name屬性: 標識結果處理的名稱.與action方法的返回值對應. type屬性: 指定調用哪一個result類來處理結果,默認使用轉發. 標簽體:填寫頁面的相對路徑 --> <result name="success" type="dispatcher" >/hello.jsp</result> </action> </package> <!-- 引入其他struts配置文件 --> <!-- <include file="cn/itheima/b_dynamic/struts.xml"></include> <include file="cn/itheima/c_default/struts.xml"></include> --> </struts> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看