Myeclipse SSH框架配置流程
此配置工具为Myeclipse 6.0,给大家做个参考,我是先配的Spring,再配Hibernate,最后再配Struts
1.先建立一个WEB工程
6.在web.xml中的<servlet>上面加入
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
7.spring配置文件中配置SessionFactory:
7.1 在注入dao的时候注入整合sessionFactory:
<bean id="woodInfoDao" class="com.sun.demo.dao.impl.WoodInfoDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
7.2 在dao实现类中要extends HibernateDaoSupport类
7.3 调用:this.getHibernateTemplete().find(HQL);
转载于:https://blog.51cto.com/guohongzhi521/380161