首页 > 其他 > 详细

struts的问题

时间:2017-03-05 17:52:27      阅读:257      评论:0      收藏:0      [点我收藏+]

将SSH框架进行整合的时候,将三者的jar包加入到lib下面,然后测试struts,结果页面显示不出来报404错误,可是路径没有问题

找到罪魁祸首是:原因两个:(1)在未用到spring的时候,先不要加struts-spring的jar包,这个会报404错误。

(2)用了spring可是但是没有在web.xml中配置监听器。

原因两个:
1.lib中多导入包的大原因:去掉struts2-spring-plugin-2.1.8包即可,因为没有用到spring。
2.还有的原因是用spring了,却没加监听器,在web.xml里面加上

    <!-- 通过上下文参数配置spring文件的位置 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:beans.xml,classpath:schedules.xml</param-value>
    </context-param>

    <!-- 上下文载入器监听器,确保web服务器启动时,直接完成spring容器的初始化 将spring容器存放在application中 -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

struts的问题

原文:http://www.cnblogs.com/fengli9998/p/6505970.html

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