多个struts-config的问题

来源:百度知道 编辑:UC知道 时间:2024/05/22 06:50:17
struts中配置多个模块,在web.xml中
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/home/struts/config/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/module1</param-name>
<param-value>/WEB-INF/home/struts/config/struts-module1.xml</param-value>
</init-param>
<welcome-file>/index.jsp</welcome-file>

index.jsp中有个链接到abc.do,如果struts-config.xml和struts-module1.xml都有abc.do,那么它会使用哪个?
请问为什么

struts-config.xml中的

要看你的web.xml文件中是怎么配置的
在web.xml中有以下一段
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

按照上面的配置,系统就会到struts-config.xml,也可以换成其他的,只要指定路径就可以了

struts-config.xml中的.
如果配置成
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,/WEB-INF/struts-module1.xml</param-value>
</init-param>
就会使用struts-module1.xml中的.

你那样配置它是通过struts-config.xml来找模块的.