10
裏面一個FacesContext的#getCurrentInstance()返回在過濾器#的doFilter空()
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
我想用
FacesContext.getCurrentInstance().getExternalContext().getSession(false);
獲取會話,但我意識到,FacesContext.getCurrentInstance()
回報null
。我知道我可以用((HttpServletRequest) req).getSession(false)
來代替這個會話,但我的具體問題是:爲什麼是doFilter()
方法中的面部背景null
?
我正在使用MyFaces 1.1。
謝謝..我想我明白了:) –