关于struts的小异常

来源:互联网 发布:网络机顶盒有哪些牌子 编辑:程序博客网 时间:2024/06/05 20:34
一:刚开始出现这个异常:

Line: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1

解决办法:

是加上包:struts2-spring-plugin-2.3.15.3.jar,并且在web.xml中配置一下:

即加上

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

二:后来还是报错,网上搜了一下,应该是在web-inf下缺少applicationContext.xml,于是随便搜了一个applicationContext.xml,放到web-inf下,还是报错,就把applicationContext.xml里面的东西修改成这样:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <context:component-scan base-package="org.apache.struts2.showcase"/>
    <context:annotation-config/>
    <!-- Showcase's CustomFreemarkerManager example -->
</beans>

修改后,问题得到解决。


0 0
原创粉丝点击