会话超时后可以保留会话吗?
比如说,我的会话超时了。之后,我是否可以向用户提供一个对话框,询问用户是否要继续会话?该对话框将有 2 个按钮“确定”和“取消”。如果用户单击“确定”,是否可以保留相同的会话?这可以在 xforms 中实现吗?另外,当会话超时时如何显示此对话框?
ORBEON.xforms.Events.errorEvent.subscribe(function(eventName, eventData) {
});
如果表单中发生任何错误,将执行上述 Java 脚本代码。但我希望仅在会话超时时执行某些操作。我怎样才能实现这个?
Say for instance, my session is timed out. After this, is it possible for me to provide a dialog box to the user asking if the user wants to continue the session or not ? The dialog will have 2 buttons OK and Cancel. If the user clicks OK, is it possible to retain the same session ? Can this be implemented in xforms ? Also, how can I display this dialog box when the session is timed out ?
ORBEON.xforms.Events.errorEvent.subscribe(function(eventName, eventData) {
});
The above Java script code will be executed if any error occurs in the form. But I want something to be executed only on session time-out. How can I implement this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一旦会话超时,您就无法再在 XForms 中执行任何操作,因为页面的 XForms 状态已丢失。当调用
errorEvent
的侦听器时,您可以在 JavaScript 中执行任何您想要的操作,但如果错误是由会话过期引起的,那么您将无法运行 XForms 代码来显示对话框。此外,会话心跳默认情况下启用的功能应该最大限度地减少用户仍在加载页面时会话过期的情况。在大多数情况下,人们使用此错误处理程序来通知用户会话已过期,然后将他们重定向到登录页面。
Once the session has timed out, you can't do anything in XForms anymore, as the XForms state for the page has been lost. When your listener to the
errorEvent
is called, you can do anything you want in JavaScript, but if the error was caused by the session being expired, again, you can't run XForms code to display a dialog. Also, the session heartbeat feature, which is enabled by default, should minimize the occurrences of session expiring while users still having a page loaded.In most cases, people use this error handler to inform users that the session has expired and then redirect them to the login page.