我在bean中创建了一个方法
public void checkSessionLife() {
if (FacesContext.getCurrentInstance().getExternalContext().getSession(false)==null) {
System.out.println("*\n");
System.out.println("destroyed");
FacesContext.getCurrentInstance().addMessage("sessiongr", new FacesMessage(FacesMessage.SEVERITY_INFO, "erer", "errrrrrrrrr"));
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update(Arrays.asList("hreaderForm:sessiongr"));
}
}
在我的PgTemlate.xhtml
我添加一个<p:poll>
来更新一个<p:growl>
<p:poll interval="5" listener="#{accessBean.checkSessionLife()}" process="@this" global="false"/>
<p:growl id="sessiongr" showDetail="true" sticky="true"/>
问题是活动被视为<p:poll>
活动会话 他有另一种方法来通知用户吗?