---SSH 整合 方式one---
1.添加Spring 支持
Core Libraries
AOP Libraries
Web Libraries
J2EE Libraries
2.添加Hibernate 支持
one--添加Hibernate 注意
第二步:
选择:Spring configuration file(applicationContext.xml)
第三步:
选择:Existing Spring configuration file
sessionFactory ID(输入): sessionFactory
第四步:
Bean Id: (input) dataSource
DB Driver: (根据需要选择)
Dialect: (根据需要选择)
第四步:
Create SeeionFactory class?(不需要选择)
two---添加添加实体及映射文件时注意
在使用HiberNate 添加实体及映射文件时,注意:
选中:(共三项)
1.Hibernate mapping file(x.hbm.xml)for each database table
a.Update hibernate configuration with mapping file location
2.Java Data Object (POJO<>DB Table)
three----add package
创建Dao,biz package
在Spring 中配置注入Dao类的 sessionFactory 参数
3.添加Struts 支持
one---- 添加Struts 支持
two---- 添加 struts-config.xml config info
在struts中配置Action 且交给Spring 管理
1.添加plug-in 配置插件(两种情况)
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"value="/WEB-INF/applicationContext.xml" />
</plug-in>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"value="classpath:applicationContext.xml" />
</plug-in>
2.配置struts-config.xml 中的Action
<action
parameter="type" path="/student"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request" validate="false">
<forward name="list" path="/list.jsp" />
</action>
3.在applicationContext.xml 中配置Action
<bean name="/student" class="com.taink.struts.action.StudentAction">
<property name="studentBiz" ref="studentBiz"/>
</bean>
---SSH 整合 方式two(最后整合Struts 时有所不同)---
1.添加Spring 支持
Core Libraries
AOP Libraries
Web Libraries
J2EE Libraries
Remoting Libraries
Misc Libraries
2.添加Hibernate 支持
one--添加Hibernate 注意
第二步:
选择:Spring configuration file(applicationContext.xml)
第三步:
选择:Existing Spring configuration file
sessionFactory ID(输入): sessionFactory
第四步:
Bean Id: (input) dataSource
DB Driver: (根据需要选择)
Dialect: (根据需要选择)
第四步:
Create SeeionFactory class?(不需要选择)
two---添加添加实体及映射文件时注意
在使用HiberNate 添加实体及映射文件时,注意:
选中:(共三项)
1.Hibernate mapping file(x.hbm.xml)for each database table
a.Update hibernate configuration with mapping file location
2.Java Data Object (POJO<>DB Table)
three----add package
创建Dao,biz package
在Spring 中配置注入Dao类的 sessionFactory 参数
3.添加Struts 支持
one---- 添加Struts 支持
two---- 添加 struts-config.xml
1.在web.xml 中配置spring
<!-- spring config -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
2.在struts-config.xml中配置
<controller>
<set-property property="processorClass"
value="org.springframework.web.struts.DelegatingRequestProcessor" />
</controller>
3.在applicationContext.xml 中配置Action
<bean name="/user" class="org.taink.struts.action.UserAction">
<property name="userBiz" ref="userBiz"></property>
</bean>