I would like to send user to /login.xhtml
if he/she is idle for a given period of time. I have tried PrimeFaces <p:idlemonitor>
but can't figure out how to achieve this.
Use the IdleMonitor
component <p:idleMonitor>
<p:idleMonitor timeout="3000">
<p:ajax event="idle" listener="#{idleMonitorBean.processTimeOut()}"/>
</p:idleMonitor>
Note: timeout
in millseconds
Then in your listener method just specify the redirect()
path.
@Model
public class IdleMonitorBean {
public void processTimeOut() throws IOException {
FacesContext.getCurrentInstance().getExternalContext().redirect(
"/contextroot/index.xhtml");
}
}