struts2零配置中的常量配置

2021-08-04 10:28:00 字數 2538 閱讀 3811

value="true"/>

value="true"/>

name

value

truts.convention.action.disablejarscanning

設定是否從jar包搜尋action類(適合於將action達成jar包的人使用,預設為true,不需要,可以自定義關閉)

struts.convention.action.packages

指定該包作為根包來搜尋action類

struts.convention.exclude.packages

排除哪些包不搜尋。按預設配置即可。逗號分割字串。 (指定的是包名)

struts.convention.package.locators.basepackage

確定搜尋包的路徑。只要是結尾為action的包都要搜尋。basepackage按照預設不用配置,如果配置,只會找以此配置開頭的包。locators及locators.basepackage都是一組以逗號分割的字串。

struts.convention.result.path

指定結果頁面路徑。 convention外掛程式會自動在此路徑中尋找檔案。放到web-inf的目的的保護檔案資源,只能通過程式內部跳轉才能訪問,我們的許可權***或其他許可權處理只要加到action上就可以了。 預設值是/web-inf/content/

struts.convention.action.name.separator

具體action的名字將根據action類名來進行轉化,首先取出action類名,其次根據駝峰命名法的類名將大寫子母小寫,預設用「-」進行分割並拼接,這樣就形成乙個action的name。

struts.convention.default.parent.package

設定預設的父包,一般我們都設定乙個default包繼承自struts-default。大部分類再繼承default。如果有特殊的類需要特殊的包,只能在action中再指定父包了。 預設值是convention-default

struts.convention.package.locators

convention外掛程式使用該常量指定的包作為搜尋的action的根包。預設值是action,actions,struts,struts2

struts.convention.package.locators.disable

指定禁止從action的根包中搜尋action,預設值false

struts.convention.relative.result.types

指定convention對映result是預設支援的結果型別,預設返回的結果型別搜尋。按順序先找相關的dispatcher的jsp檔案是否存在。然後再找freemarker,再找velocity。 預設值dispatcher,freemarker,velocity

struts.convention.redirect.to.slash

設定是否重定向到(/),例如當/login不存在時且設定值為true是,重定向到/login/,預設值true

struts.convention.action.suffix

convention搜尋actioo類的類名字尾,預設值action,不建議修改

struts.convention.action.name.lowercase

設定是否在對映action的時候,所有字母都小寫,預設值true

struts.convention.action.checkimplementsaction

是否將實現了action介面的類應射程action,預設值是true

struts.convention.action.mapallmatches

設定即使沒有@action註解時仍然建立action對映,預設值false

struts.convention.result.flatlayout

如果此值設為true,如果乙個action的namespace為/login,名稱為helloworldaction。result返回值是 success,缺省會找到/web-inf/pages/login/hello-world.jsp(如果有hello-world- success.jsp就找這個檔案,連線符「-」是在中配置的)。如果有乙個action的result返回值是「error」,就會找/web-inf/pages /login/hello_world_error.jsp。 如果此值設為false,如果乙個action的命名空間為/login,名稱為helloworldaction。result返回值是 success,缺省會找到/web- inf/pages/login/hello_world/index.jsp(如果有success.jsp就找這個檔案)。如果有乙個action的 result返回值是「error」,就會找/web-inf/pages /login/hello_world/error.jsp。

struts.convention.action.includejars

包括哪些jar包中的action。逗號分割字串

struts.convention.classes.reload

參考自鏈結(博主稍作修改和整理,更加詳細了些.

struts2常量配置

struts2常量配置 1.在struts.xml中配置。例如 2.在struts.properties中配置,該檔案的內容就是系列的key value對。例如 struts.devmode true 指定了struts2應用處於開發階段 3.在web.xml中配置struts2常量,可以通過元素的...

struts2 常量配置

sturt2中搜尋載入常量的順序是 struts default.xml 在struts2 core.jar檔案中 struts plugin.xml 在struts2 jar等struts2外掛程式jar檔案中 struts.xml web應用預設的struts2的配置檔案 sturts.prop...

struts2常量配置詳情

可以在src 下新建乙個struts.properties檔案 記住不要寫錯了 然後這樣寫 struts.configuration.xml.reload true struts.action.extension action struts2常量的具體用法例項 xml apache software...