在struts-config.xml配置如下:
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml" />
</plug-in>可是运行时总是说Servlet action找不到
Spring的Web包也已经加到classpath下了是什么原因这个错误的呢?
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml" />
</plug-in>可是运行时总是说Servlet action找不到
Spring的Web包也已经加到classpath下了是什么原因这个错误的呢?
所以判断应该是PlugIn中org.springframework.web.struts.ContextLoaderPlugIn这个类找不到,但是Spring的包确实是在classpath下的啊百思不得其解
把你spring的对action的配置贴出来,还有struts-config.xml中的action配置,以及web.xml中struts-config.xml配置信息,还有你页面调用action的路径。
<html:form action="login">
userName : <html:text property="userName" />
<html:errors property="userName" />
<br />
password : <html:text property="password" />
<html:errors property="password" />
<br />
<html:submit />
<html:cancel />
</html:form>struts-config中Action的配置:
<action
path="/login"
type="org.springframework.web.struts.DelegatingActionProxy"
name="loginForm">
<forward
name="success"
path="/main.jsp">
</forward>
<forward
name="failure"
path="/index.jsp">
</forward>
</action>applicationContext.xml中的相关配置:
<bean name="/login" class="com.blog.web.struts.action.LoginAction" singleton="false">
<property name="userDAO">
<ref local="userDAOProxy"/>
</property>
</bean>web.xml中的配置:
<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>2</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>注:applicationContext.xml和struts-config.xml都在WEB-INF目录下
是可以访问到Action的但是加上PlugIn就不行了