此处注意点有二
1.当使用../ 时返回的目录为WEB-INF目录,所以直接写为如下即可
<filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> <init-param> <param-name>config</param-name> <!-- 配置装载struts.xml路径,其中struts.xml放在/WebContent/WEB-INF/下--> <param-value>struts-default.xml,../ struts.xml</param-value> </init-param> </filter>
2.如果把struts.xml路径改变了,当加载时必须把struts-default.xml写上,否则服务器将找不到struts-default.xml。
当然,用在struts.xml中用include方法来包含其他路径下的配置文件当然也能达到这种效果。