spring和struts整合时出现的两个循环出现的问题
2017-04-25 16:41
323 查看
先出现:
Unable to load configuration. - action - file:/D:/important_software/apache_tomcat8.0/apache-tomcat-8.0.37/webapps/struts_spring/WEB-INF/classes/struts.xml:10:59
改了struts.xml中的class
<package name="user" extends="struts-default">
<action name="user" class="com.action.UserAction" method="execute">
<result name="success">/index.jsp</result>
</action>
</package>
可以运行,但java.lang.NullPointerException
spring中也实例了action,这样实例化对象无法setter ,出现null
<bean id="UserAction" class="class="com.action.UserAction"">
<property name="userservice" ref="UserService"/>
</bean>
不妨修改为
struts.xml
<action name="adduser" class="这里就是spring 注册的action bean 的id">
eg:<action name="adduser" class="UserAction">
spring.xml
<bean id="UserAction" class="com.action.UserAction" scope="prototype">
<property name="userservice" ref="UserService"/>
</bean>
但有又出现了Unable to load configuration. - action - file:/D:/important_software/apache_tomcat8.0/apache-tomcat-8.0.37/webapps/struts_spring/WEB-INF/classes/struts.xml:10:59
两个问题反复出现
最后发现是没有导struts1-spring-plugin-2.3.32.jar
当struts和spring 整合时,处理spring和struts要导的包,还要导两个包:spring-web-4.3.8.RELEASE.jar和struts1-spring-plugin-2.3.32.jar
Unable to load configuration. - action - file:/D:/important_software/apache_tomcat8.0/apache-tomcat-8.0.37/webapps/struts_spring/WEB-INF/classes/struts.xml:10:59
改了struts.xml中的class
<package name="user" extends="struts-default">
<action name="user" class="com.action.UserAction" method="execute">
<result name="success">/index.jsp</result>
</action>
</package>
可以运行,但java.lang.NullPointerException
spring中也实例了action,这样实例化对象无法setter ,出现null
<bean id="UserAction" class="class="com.action.UserAction"">
<property name="userservice" ref="UserService"/>
</bean>
不妨修改为
struts.xml
<action name="adduser" class="这里就是spring 注册的action bean 的id">
eg:<action name="adduser" class="UserAction">
spring.xml
<bean id="UserAction" class="com.action.UserAction" scope="prototype">
<property name="userservice" ref="UserService"/>
</bean>
但有又出现了Unable to load configuration. - action - file:/D:/important_software/apache_tomcat8.0/apache-tomcat-8.0.37/webapps/struts_spring/WEB-INF/classes/struts.xml:10:59
两个问题反复出现
最后发现是没有导struts1-spring-plugin-2.3.32.jar
当struts和spring 整合时,处理spring和struts要导的包,还要导两个包:spring-web-4.3.8.RELEASE.jar和struts1-spring-plugin-2.3.32.jar
相关文章推荐
- struts2.3整合spring3.2出现无法注入的问题
- 用Myeclipse5.5+Tomcat5.5整合Spring2.0+struts1.2时出现的兼容性问题及解决办法
- Struts Spring Hibernate 框架整合时候出现的问题
- spring3.1+JPA整合struts2.3出现的各种问题和错,其实主要还是jar包冲突
- Struts Spring Hibernate 框架整合时候出现的问题
- struts+spring+hibernate整合出现的问题解决方法
- Struts,Hibernate,Spring整合开发中 DATE类型存入和显示问题
- Spring3.0 整合 Struts2.0 出现的异常
- struts+spring+hibernate整合问题解决方法 陆续更新中....
- 关于用spring来管理Struts中的action 所出现的问题
- 关于struts2.1.8 spring ibatis 与 dwr2的整合 遇到的问题
- spring和struts整合中注意的问题
- 整合Struts2+Spring2.5的时候遇到一个问题
- 解决struts2.1.6整合Spring乱码问题
- spring和struts整合中注意的问题
- 关于struts2.1.8 spring ibatis 与 dwr2的整合 遇到的问题( 二 )
- 有关Struts和Spring框架整合时出现的问题
- MyEclipse 7.0M1 SSH 整合开发问题解决:Spring2.5+hibernate3.1+Struts1.3 +Tomcat6.0
- xfire与spring整合出现问题
- 关于同 Struts 2.0.6 配合使用 Spring 出现的问题