我的spring和struts怎么总是整合不对呢?我都整了好几天了!!!
我的spring和struts怎么总是整合不对呢?我都弄了好几天了,我都快疯了!!!只运行struts是正确的,但是一加入spring就出错了!
现象是:运行时候提示:Servlet action is not available
我配置了这两个文件,各位看一看我配的对不对,还要配置其他的文件吗?
1、我的struts-config(在WEB-INF目录下)的主体如下:
“
<struts-config>
<data-sources />
<form-beans>
<form-bean
name="myForm"
type="com.action.myForm">
</form-bean>
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path="/myAction"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request"
input="index.html"
name="myForm">
<forward name="success" path="/success.jsp"/>
</action>
</action-mappings>
<message-resources parameter="com.yourcompany.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
</struts-config>
”
2、applicationContext.xml(在WEB-INF目录下)的主体如下:
“
<bean name="/myAction"
class="com.action.myAction"/>
”
3、在jsp的form的action:action="myAction.do"
4、web.xml内容如下:
<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.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
[此贴子已经被作者于2007-4-19 17:09:36编辑过]