1.由spring处理的路径就可以带classpath:
2.在<tx:advice id="advice" transaction-manager="transactionManager">中别忘加transactionManager,不加也会自动带
3.页面上提示no Session 时的处理方式:
01.在hbm.xml配置文件中lazy为false
02.在dao中执行查询时使用迫切左外连接
03.使用OpenSessionInViewFilter(使用OpenSessionInViewFilter也会出现原来没有的错误,比如说用户修改的时候)
具体使用方法:①导入spring的一个jar包
②在web.xml中配置如下即可。
<filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
注意:以上这段配置不能放在struts2拦截器配置的下面
4.action,service,dao以及struts.xml中最好分别以处理的对象区分开来
5.在hbm.xml中配置时最好不要带fetch="join"而在dao中自己加
6.若表单项的disabled属性为true那么这一项就不会提交