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