您的位置:首页 > 编程语言 > Java开发

搭建SSH框架Struts2.1、Spring2.5、Hibernate3.3

2012-10-22 15:37 525 查看
Web Project这个都会吧!细细

版本

Struts2.1、Spring2.5、Hibernate3.3

1.MyEclipse add Struts2.1 → /* Struts2 Spring Libraries(导入这个包)

2.MyEclipse add Spring导入AOP 、Spring2.5 Presistence Core 、Spring2.5 Presistence JDBC、Spring2.5 Web Libraries

3.MyEclipse add Hibernate3.3 选第二个 Spring onfiguration file(applicationContext.xml) →Existing Spring onfiguration file →选择数据源→不创建SessionFactory

4.web.xml配置 在Dsign配置,找到Context Parameters →Parameter name填:contextConfigLocation;Parameter value填:classpath:applicationContext.xml(如果applicationContext.xml放在src下面写classpath,如果放在WEB-INF/lib/下就这么写/WEB-INF/lib/applicationContext.xml)

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/lib/applicationContext.xml</param-value>
</context-param>

5.Listeners →Browse 写上contextLoader就有提示contextLoaderListener就ok了

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

之后就部署吧!

SSH Demo下载地址Mysql数据库http://pan.baidu.com/share/link?shareid=152796&uk=1712110123

因之前搭建ssh总出错!之后总结了一下,本人学生仅供其他学生参考,不喜勿喷!谢谢
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: