1. 程式人生 > >struts2相關配置檔案

struts2相關配置檔案

struts2中的相關配置檔案:

  • struts.xml
  • struts-default.xml
  • default.properties
  • struts.properties
  • web.xml

struts.xml是struts2的核心配置檔案,需要自己建立(建立參照struts學習基礎文章)。
struts.xml中的package有個extend屬性,通常會繼承自struts-default.xml。


struts-default.xml中定義的許多標籤在struts.xml中都會有相對的用處,且定義很多引數預設值。


default.properties

裡都是struts2自己定義的一些常量(.properties檔案裡一般都是鍵值對)。


struts.properties用於覆蓋default.properties裡的值或者自己新建常量鍵值對。


web.xml則是web應用的整體配置檔案,裡面也可以定義struts的常量等進行其他struts2配置。


在配置方面,對於struts.xml,struts.properties,web.xml是自己建立配置的,這三個檔案有些共同的可設定點。這幾個配置檔案的優先順序為:
struts.xml < struts.properties < web.xml