Struts2.0加載配置順序

 

Struts2.0默認的加载顺序:

Constants can be declared in multiple files. By default, constants are searched for in the following order, allowing for subsequent files to override previous ones:

  1. struts-default.xml
  2. struts-plugin.xml
  3. struts.xml
  4. struts.properties
  5. web.xml

The struts.properties file is provided for backward-compatiblity with WebWork.

 

 

 

通常struts2加载struts2常量的顺序如下:

struts-default.xml

struts-plugin.xml

struts.xml

struts.properties

 web.xml

在不同的配置文件里存在相同的常量的话,后者将会覆盖前者.

启动Tomcat可在控制台看到

这应该是这么配置文件的加载顺序吧.

不过一般情况还是建议把struts2常量写到struts.xml里

 

在Struts.properties中设置改变加载顺序:

 

### A list of configuration files automatically loaded by Struts
struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml

你可能感兴趣的:(tomcat,Web,xml,struts,Webwork)