option1:
<meta http-equiv="refresh" content="#{facesContext.externalContext.sessionMaxInactiveInterval};url=#{request.contextPath}/session-timeout.xhtml" />
option2: The magic we can do with the help of PrimeFaces idle monitor.
<p:idleMonitor timeout="600000">
<p:ajax event="idle" listener="#{loginBean.onIdle}" update="@this form" />
<!-- <p:ajax event="active" listener="#{loginBean.onActive}" update="@this form" /> -->
</p:idleMonitor>
Added below code in your managed bean
public void onIdle() {
/* FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,
"No activity.", "What are you doing over there?"));*/
extCon = FacesContext.getCurrentInstance().getExternalContext();
extCon.invalidateSession();
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("session-timeout.xhtml?faces-redirect=true");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void onActive() {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,
“Welcome Back”, “Well, that’s a long coffee break!”));
}