type Status reportmessage Servlet action is not availabledescription The requested resource (Servlet action is not available) is not available.下面是我的部分重要代码。(出现上面的错误似乎和下面这些数据有关,因为我如果仅仅用Struts+hibernate来实现操作的话就没有任何问题,加入spring代理的以下代码就出现上面的错误了)Struts-config里主要的代码:
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/>
<message-resources parameter="com.luoxg.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn" >
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in> /WEB-INF下的Spring配置文件 applicationContext里的主要代码:
<bean name="/user" class="com.luoxg.struts.action.UserAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
<property name="userService">
<ref local="userService" />
</property>
</bean>有人提议把plug-in属性从Struts配置文件里替换到web.xml中试一下 我也照做了:
web.xml主要代码:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> 但是无论如何还是有上面的那个错, 即使我再把Spring.jar这个myeclipse没有导入的包手工导入后,结果还是错。哪位朋友能帮我解决下上面的问题啊,万分感谢。。
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/>
<message-resources parameter="com.luoxg.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn" >
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in> /WEB-INF下的Spring配置文件 applicationContext里的主要代码:
<bean name="/user" class="com.luoxg.struts.action.UserAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
<property name="userService">
<ref local="userService" />
</property>
</bean>有人提议把plug-in属性从Struts配置文件里替换到web.xml中试一下 我也照做了:
web.xml主要代码:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> 但是无论如何还是有上面的那个错, 即使我再把Spring.jar这个myeclipse没有导入的包手工导入后,结果还是错。哪位朋友能帮我解决下上面的问题啊,万分感谢。。
类,写出来看看呀。建议你先把bean “/user”的属性去掉即写成下面的样子
<bean name="/user" class="com.luoxg.struts.action.UserAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
</bean> 然后再改改相关的文件配置再测试看看。把复杂的问题简单化嘛。
如果按我说的做 没有出现错误的话 那就证明struts和spring的整合设置没有错,
错在你的property属性的userService上了