设为首页 加入收藏

TOP

Struts2与Spring整合步骤
2014-11-24 02:58:00 来源: 作者: 【 】 浏览:1
Tags:Struts2 Spring 整合 步骤

1.加入jar包


复制文件。


复制struts2-spring-plugin-x-x-x.jar和spring.jar到WEB-INF/lib目录下。其中的x对应了Spring的版本号。还需要复制commons-logging.jar、struts2-core-2.3.4.1.jar文件到WEB-INF/lib目录下。


2. 配置web.xml


< xml version="1.0" encoding="UTF-8" >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
game.cai


encodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
utf-8


forceencoding
true



encodingFilter
/*




struts2

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter



struts2
/*





org.springframework.web.context.ContextLoaderListener




contextConfigLocation

classpath:/applicationContext*.xml



hibernateOpenSessionInViewFilter

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter




struts2CleanUpFilter

org.apache.struts2.dispatcher.ActionContextCleanUp





index.html
index.htm
index.jsp
default.html
default.htm
default.jsp


3.添加struts2-spring整合的插件:struts2-spring-plugin-2.0.12.jar,如果不使用这个插件,则需要在struts.xml里面配置:


推荐阅读:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇基于Socket的Java网络编程 下一篇Java构建工具 ANT 简明教程

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: