首页 > 编程语言 > 详细

spring与struts2整合出现错误HTTP Status 500 - Unable to instantiate Action

时间:2017-06-05 23:12:30      阅读:554      评论:0      收藏:0      [点我收藏+]

在进行spring和struts2整合的时候因为大意遇到了一个问题,费了半天神终于找到了问题所在,故分享出来望广大博友引以为戒!!

我们都知道在spring和struts2整合时,spring接管了action对象的创建,所以一定要在spring配置文件中配置action,这里需要注意的是配置<bean id="???">中的id时,

要与struts.xml配置action中的<action class="???">class一致,否则就会出现如下问题:

技术分享

 

楼主就是因为把struts.xml配置action中的class写成了action类路径,导致了这个问题,所以亲们一定要注意!

错误配置代码:applicationContext.xml中<bean id="cartAction" class="com.ansibee.shop.web.action.CartAction" scope="prototype">

       struts.xml中<action name="cart_*" class="com.ansibee.shop.web.action.CartAction" method="{1}">

 

正确配置代码:applicationContext.xml中<bean id="cartAction" class="com.ansibee.shop.web.action.CartAction" scope="prototype">

       struts.xml中<action name="cart_*" class="cartAction" method="{1}">

spring与struts2整合出现错误HTTP Status 500 - Unable to instantiate Action

原文:http://www.cnblogs.com/ansibee/p/6947257.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!