我想实现倒计时时钟,然后在时间结束时完成我的实际会话并将我重定向到登录页面,我怎么能这样做我PRIMEFACES ...我不想使用IdleMonitor因为我想显示一条消息我的倒计时结束时再次登录,对我来说非常重要,以显示剩下的时间
$(function() {
$('#time').chrony({
second: 15,
finish: function() {
this.html('Finished!'); -- Here i want to call a logout function and redirect to login page
}
});
});
这是一个jquery时间停机时钟,但我想在完成时称我为Bean Session Timeout
我在primefaces中读到了remoteCommand ...有什么想法吗?
在这种情况下,您可以像这样使用p:remoteCommand
:
<-- this goes somehwere on your page -->
<p:remoteCommand name="timeout" action="#{bean.sessionTimeout}" />
和你的javascript:
$(function() {
$('#time').chrony({
second: 15,
finish: function() {
this.html('Finished!');
timeout();
}
});
});
但也许值得考虑使用framework来帮助您进行用户身份验证和会话生命周期管理。