Session 当浏览器的多个选项卡中有多个网页处于活动状态时,Primefaces空闲监视器
在我们的web应用程序中,我们有一个baseTemplate.xhtml,我的应用程序的每个页面都使用此模板。此baseTemplate.xhtml具有处理空闲监视器的功能。Session 当浏览器的多个选项卡中有多个网页处于活动状态时,Primefaces空闲监视器,session,jsf,primefaces,Session,Jsf,Primefaces,在我们的web应用程序中,我们有一个baseTemplate.xhtml,我的应用程序的每个页面都使用此模板。此baseTemplate.xhtml具有处理空闲监视器的功能。 问题/问题: 如果用户打开多个选项卡,其中一个选项卡处于活动状态,但另一个选项卡在指定的会话超时值内处于空闲状态,则该用户将被注销 要求: 我希望如果用户打开了多个选项卡,并且其中一个选项卡处于活动状态,则空闲监视器不应注销 <h:form> <p:confirmDialog id="confirmDia
问题/问题: 如果用户打开多个选项卡,其中一个选项卡处于活动状态,但另一个选项卡在指定的会话超时值内处于空闲状态,则该用户将被注销
要求: 我希望如果用户打开了多个选项卡,并且其中一个选项卡处于活动状态,则空闲监视器不应注销
<h:form>
<p:confirmDialog id="confirmDialog"
message="Please click Ok before the timer runs out: "
header="Are you there?"
severity="alert"
closable="false"
widgetVar="idleDialog">
<p:commandButton id="confirm"
value="Ok"
process="@this"
onclick="clearTimeout(window.logoffTimeoutId); PF('idleDialog').hide();"/>
</p:confirmDialog>
<p:remoteCommand name="terminateIdleSession"
actionListener="#{idleMonitorView.onIdle}"
process="@this"
out="count"/>
<p:idleMonitor timeout="#{5 * 60 * 1000}"
onidle="startTimer()"/>
</h:form>
<script type="text/javascript">
//<![CDATA[
function startTimer() {
clearTimeout(window.logoffUpdaterId);
PF('idleDialog').show();
// Set timeout to 2 minutes
var timeout = 2 * 60 * 1000;
// Calculate when the time runs out
window.logoffTime = new Date().getTime() + timeout;
// Start timer which calls remote command
window.logoffTimeoutId = setTimeout(terminateIdleSession, timeout);
// Update timer every second
window.logoffUpdaterId = setInterval(updateTimer, 1000);
// Update timer now
updateTimer();
}
// Update the timer
function updateTimer() {
var seconds = Math.ceil((window.logoffTime - new Date().getTime()) / 1000);
$("#logoffTimeout").html(seconds);
}
// Create span to contain the timer
$(function(){
$("#myForm\\:confirmDialog .ui-confirm-dialog-message").append("<span id=logoffTimeout/>");
});
//]]>
</script>
//
有点晚了,但我希望它对某些人有用。Primefaces的idleMonitor
现在有一个multiWindowSupport
属性,因此您将得到如下结果:
<p:idleMonitor timeout="5000" multiWindowSupport="true" onidle="PF('idleDialog').show()" />
有点晚了,但我希望它对某些人有用。Primefaces的
idleMonitor
现在有一个multiWindowSupport
属性,因此您将得到如下结果:
<p:idleMonitor timeout="5000" multiWindowSupport="true" onidle="PF('idleDialog').show()" />
如果其他空闲监视器没有焦点,则用于启动/停止这些监视器。也许您需要重新启动/将其重置为。最后,客户端都是html/css/javascriptI,我刚刚添加了源代码,请你帮我修复一下,我不擅长java scriptUse,如果其他空闲监视器没有焦点,可以启动/停止它们。也许您需要重新启动/将其重置为。最后,客户端都是html/css/javascriptI,我只是添加了源代码,请你帮我修复一下,我不太擅长java脚本