下面是部分代码,望高手指点:
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> config/user </param-name>
<param-value> /WEB-INF/user/struts-config-user.xml </param-value>
</init-param>
<load-on-startup> 2 </load-on-startup>
</servlet>
------------------------------------------------
struts-config-user.xml
------------------------------------------------
<action path = "/userAgain "
type = "org.springframework.web.struts.DelegatingActionProxy "
name = "IndexForm "
scope = "request "
validate = "false "
input = "/jsp/user.jsp "
>
</action>
......
<plug-in className= "org.springframework.web.struts.ContextLoaderPlugIn ">
<set-property property= "contextConfigLocation " value= "/WEB-INF/user/applicationContext-user.xml "/>
</plug-in>
------------------------------------------------
applicationContext-user.xml
------------------------------------------------
<bean name= "/userAgain " class= "action.UserAction " singleton= "false ">
<property name= "userServices ">
<ref bean= "userServices " />
</property>
</bean>
------------------------------------------------
运行时报错:
javax.servlet.ServletException: No bean named '/user/userAgain ' is defined
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '/user/userAgain ' is defined
------解决方案--------------------
提示的很清楚啊,你在定义文件中定义的是/userAgain,而你要引用的是/user/userAgain
------解决方案--------------------
在struts-config-user.xml中提交的是/userAgain
在applicationContext-user.xml配的也是/userAgain
如果配成/user/userAgain
一样报错
------解决方案--------------------
配置文件中类的路径没有写对