1.注意:
如果application.xml中配置了依赖:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.2.1</version>
</dependency>
并且web.xml中配置了application.xml的内容 :
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
就需要添加struts2-spring-plugin-2.2.1.1.jar包(版本可以不是2.2.1.1可以是其他版本)
如果没有上边的两段配置,就不能添加struts2-spring-plugin-2.2.1.1.jar包(此jar包是spring和struts整合用的)
如果加了就要报一下错误:
严重: Exception starting filter struts2
Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1
或者以下情况也需要添加这个jar包
当struts.xml的action 中的class属性值为application.xml里bean标签的id属性值时必须添加struts2-spring-plugin-2.2.1.1.jar包
action 中的class值为 包名.类名时不需要添加