问题:
jsf页面跳过登录界面直接进入首页,但是不能正常显示内容
原因是获取不到session变量
解决:
在web.xml中设置session filter
代码如下
<filter>
<filter-name>Session Timeout Filter</filter-name>
<filter-class>cn.com.hd.common.filter.SessionTimeoutFilter</filter-class>
<init-param>
<param-name>redirectURL</param-name>
<param-value>/loginOut.jsp</param-value>
</init-param>
<init-param>
<param-name>exceptFiles</param-name>
<param-value>/#/login.faces#/resources/css/login_css.css#/resources/images/login/dl_r1_c1.jpg#/resources/images/login/dl_r1_c2.jpg#/resources/images/login/dl_r1_c3.jpg#/resources/images/login/dl_r2_c1.jpg#/resources/images/login/dl_r2_c2.jpg#/resources/images/login/dl_r2_c3.jpg#/resources/images/login/dl_r3_c1.jpg#/resources/images/login/dl_r3_c2.jpg#/resources/images/login/dl_r3_c3.jpg#/resources/images/login/dl_r3_c4.jpg#/resources/images/login/dl_r3_c5.jpg#/loginOut.jsp</param-value>
</init-param>
<init-param>
<param-name>enable</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Session Timeout Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>