问题:
1.no session or session was closed
2.Could not obtain transaction-synchronized Session for current thread
解决:
在web.xml中配置OpenSessionInViewFilter
<!--配置Session -->
<filter>
<filter-name>openSession</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSession</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>