三大框架之中,先导入Spring框架,是因为需要Spring的容器对另外两个框架进行管理,所以在web.xml需要启动Spring容器。
在web.xml中输入以下内容:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
如果没有在web.xml创建监听
然后控制台就会报以下错误:
Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 220 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1