struts2常量配置

常量提供了一個簡單的方法來定製Struts應用程序經過定義關鍵設置修改插件框架和行爲。spring

 

  1. struts-default.xml—基礎xml,默認包含這個文件是自動裝入struts.xml文件,當咱們進行.自行開發時須要繼承struts-default
  2. struts-plugin.xml—插件相關

  3. struts.xml—核心內容

  4. struts.properties --框架使用許多屬性 ,改變這些屬性時一般定義文件在classpath下
  5. <constant name="struts.i18n.encoding" value="UTF-8" />
    指定默認編碼集,做用於HttpServletRequest的setCharacterEncoding方法和freemarker、velocity的輸出

  6. <constant name="struts.action.extension" value="do" /> 
    改變action的後綴

  7. <constant name="struts.configuration.xml.reload" value="true" />
    當struts的配置文件修改後,系統是否自動從新加載該文件,默認爲false,開發階段最好打開,這樣不用重啓服務器。

  8. <constant name="struts.devMode" value="true" />
    開發模式下使用,這樣能夠打印出更詳細的錯誤信息

  9. <constant name="struts.multipart.maxSize" value="10701096" /> 
    上傳文件的大小限制,value值表示總大小,不是單個文件。

  10. <constant name="struts.objectFactory" value="spring"/>
    與spring集成時,指定由spring負責action對象的建立

  11. <constant name="struts.enable.DynamicMethodInvocation" value="true" />
    該屬性設置struts2師傅支持動態方法調用,該屬性的默認值是true。如需關閉,則設置value="false"。
相關文章
相關標籤/搜索