Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 上下文已销毁,但会话仍处于打开状态_Java_Jsf_Session State - Fatal编程技术网

Java 上下文已销毁,但会话仍处于打开状态

Java 上下文已销毁,但会话仍处于打开状态,java,jsf,session-state,Java,Jsf,Session State,我是jsf新手,我读到过可以销毁会话的内容 FacesContext fc = FacesContext.getCurrentInstance(); HttpSession session = (HttpSession) fc.getExternalContext().getSession(false); fc.getExternalContext().getSessionMap().clear(); session.invalidate(); 我的问题是,在这样做之后,会话仍

我是jsf新手,我读到过可以销毁会话的内容

FacesContext fc = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);      

fc.getExternalContext().getSessionMap().clear();

session.invalidate();
我的问题是,在这样做之后,会话仍然处于活动状态,具有以下bean:

com.sun.faces.renderkit.ServerSideStateHelper.LogicalViewMap

你有什么想法吗

那只是一次新的会议。要自己测试它,请在invalidate之前和之后的请求期间检查的值。应该有所不同


与具体问题无关,无论何时调用
invalidate()
,都不需要清除会话映射。无论如何,会话映射都将被丢弃。还要注意,
getSession(false)
可能返回
null
,您需要添加额外的检查以避免
null点异常
。或者只需使用
getSession(true)