Struts+spring, 多模块Struts配置文件

1. web.xml
...
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/system</param-name>
<param-value>/WEB-INF/struts-config-system.xml</param-value>
</init-param>
...
2. struts-config.xml

...
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml"/>
</plug-in>

...
3. struts-config-system.xml
<action path="/loginout" type="org.springframework.web.struts.DelegatingActionProxy"
parameter="act"
name="logonForm">
</action>

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext-system.xml"/>
</plug-in>
4.applicationContext-system.xml
<bean name="/loginout" class="com.comp.system.action.LoginoutAction" singleton="false">
<property name="systemService"><ref bean="SystemService"/></property>
</bean>

jsp页面中<form action="system/loginout.do">调用
页面出现404错误:
type Status report

message Invalid path was requested

description The requested resource (Invalid path was requested) is not available.
后台提示:
ERROR RequestProcessor:676 - Invalid path was requested /loginout
不知道具体原因是什么? 网上解决类似问题的帖子 都没有 明确给出解决方法。

 

================================================================

struts1.x配置多模块的config时,spring中的bean的name要加上模块名称。

 

在applicationContext-system.xml 中,把 name="/loginout" 修改为 name="/system/loginout"调用就没问题了 。

你可能感兴趣的:(spring,xml,bean,Web,struts)