問題:
SSH項目多對多關係映射,懶加載出現問題,我已經在web.xml添加了如下設置:
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
但是似乎沒起作用……看了好幾篇博文,才知道錯在哪裏,我好蠢哦!
<url-pattern>*.action</url-pattern>
這裏,要後綴名爲.action的URL纔會被這個攔截器過濾!!
我的action,emmmmm沒加後綴。。。。
另外,看好幾篇博文說這個過濾器和struts的配置加載順序也有關,要把這個配置放在struts配置前邊。