web.xml中struts-config.xml中两者不可兼得

来源:百度知道 编辑:UC知道 时间:2024/06/20 15:43:38
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xm

<param-name>config</param-name>

getServletConfig().getInitParameter(“config”)

3参数名字都叫config,他当然只会运行最后一个
就好像
int i=1;
i=2;
i=3;

最后肯定是3

为什么要那样配置呢?直接写成这样不就可以了吗?
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,
/WEB-INF/card/struts-configcard.xml,
/WEB-INF/information/struts-configinformation.xml,
/WEB-INF/arrange/struts-configarrange.xml
</param-value>
</init-param>

如果想配置多个struts-config可以采用子模块的方式。
详细可见doc,user guide->Configuring Applications->Configuring your application for modules里会有详细说明,包括不同模块之间的跳转.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="struts.xml中 关于struts中validation.xml的问题 struts 中怎么配置多个struts-config.xml文件 在j2ee中SSH(spring+struts+hibernate)整合,在程序代码如何访问WEB-INF文件夹中的.xml文件? 关于struts2的web.xml和struts.xml部署的疑问 struts config.xml java中web.xml具体是什么 web.xml中filter的设置 怎样在struts中的struts-config.xml中建立sql2000数据源。 在struts框架的web程序中,http请求服务器,struts执行的全过程