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");
}
}