在添加Spring 和 Hibernate 的库文件后不能随意的移动库文件的位置,
因为在有些文件中有位置描述如.myhibernatedata中就有hibernate
依赖目录描述
1:新建 MyEclipse J2EE Web Application Project2:添加WebWork2.2.5库文件
将WebWork2.2.5.jar和default目录下的依赖文件copy到项目中3:修改web.xml文件,添加以下内容
<filter>
<filter-name>webwork</filter-name>
<filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
和 "wedwork,spring ,Hibernate!!整合过程详细" 有关的编程小帖士:
strong>Int32.Parse(变量) Int32.Parse("常量") 字符型转换 转为32位数字型
<filter-name>webwork</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>4:添加以下文件到src目录下:
webwork.properties
webwork-default.xml
xwork.xml5:添加 Spring Capabilities
勾选将所有Spring 库文件以及依赖库文件,并勾选copy到项目文件夹6:添加 Spring Hibernate Capabilities
勾选将所有Hibernate 库文件以及依赖库文件,并勾选copy到项目文件夹
在操作向导中,当出现 select the type of configuration file
MyEclipse Hibernate Tools will use for this project 时, 选
择Spring configuration file(applicationContext.xml)这样当利用
Hibernate 返向工具时,MyEclipse 会自动对applicationContext.进行操作7:将applicationContext.xml 文件copy到/WEB-INF/目录下,这是整合的关键
WebWork在这个目录下自支寻找applicationContext.xml文件8:修改.springBeans文件
<config>src/applicationContext.xml</config>需改为
<config>/WebRoot/WEB-INF/applicationContext.xml</config>
这样MyEclipse的Spring 工具才能找到该文件9:修改myhibernateddata文件
configFile=/aixin/src/applicationContext.xml需改为
configFile=/aixin/WebRoot/WEB-INF/applicationContext.xml
这样MyEclipse的 Hibernate 工具才能找到该文件