SSH中spring和struts2整合遇到的问题,Action class not found

来源:互联网 发布:淘宝新规则2016年9月 编辑:程序博客网 时间:2024/05/16 07:25

我们在对sturts.xml配置文件中的action进行配置时,action指向的class往往是spring配置文件applicationContext.xml中的been名,这时候出现了action class not found的问题。检查action定义正确,仍报错。可能有下列两个原因:
1.未导入struts2-sping-plugin 2.0.1.jar(在struts包中)
struts2-sping-plugin 2.0.1.jar用于将struts.xml配置文件和spring配置文件关联起来。在lib中导入struts2-sping-plugin 2.0.1.jar即可
2.struts.xml没有交与spring管理
在struts.xml中还要加入这么一个bean
<bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" class="org.apache.struts2.spring.StrutsSpringObjectFactory" />

这个bean要放在package的外面

0 0
原创粉丝点击