Hibernate 关闭sessionFactory :
关闭sessionFactory是应在服务器被关闭,程序被卸载时关闭,所以需要写一个sessionFactory特有的监听类,当服务器被关闭时,自动关闭sessionFactory.
写个监听类 实现ServletContextListener 在该类中关闭关闭sessionFactory ,以下就是:
将监听类配置在web.xml 中
<listener>
<listener-class>cn.com.csuinfosoft.listener.HibernateListener</listener-class>
</listener>
-------------------------------------------------------------------------------------
<html:form action="完整类名"/> //这个action 的请求对应了struts-config.xml中的form-bean,那么下面直
接用一属性就可以了
<html:text property="ename"/> 这样就能显示对应得form-bean中的ename属性
html标签用于一个对应得form-bean
若是多个form组成的list,那么可以用c标签
--------------------------------------------------------------------------------------
用html标签做时,应该注意,在action中将request.setAttribute("empForm",empform);
empForm要与struts-config.xml 中配置的
<form-bean name="empForm" type="com.actionForm.empActionForm"></form-bean>
name="empForm"保持一致,否则是会报错的。
-----------------------------------------------------
加油~!/(^o^)/~