【问题标题】:How can I increase the display time of a View Expired error page?如何增加 View Expired 错误页面的显示时间?
【发布时间】:2018-06-05 16:08:12
【问题描述】:

我已经按照herehere 的描述实现了 ViewExpiredException 处理(感谢@BalusC 和团队)。它工作正常。但是,错误页面闪过得很快,以至于用户没有被告知他/她由于会话超时而被重定向。有没有办法让事情慢一点?

这是错误页面:

<html lang="en">
<head>
    <title>Session Expired</title>
    <meta http-equiv="refresh" content="0;url=#{request.contextPath}/index.xhtml" />
</head>
<body>
    <h1>Session Expired</h1>
    <h3>You will be redirected to the starting page</h3>
    <p><a href="#{request.contextPath}/index.xhtml">Click here if the redirect didn't work or if you are impatient.</a></p>
</body>

【问题讨论】:

  • 我不希望它消失。确定您的错误页面中没有一些 http 元刷新或其他内容?
  • 是的,我愿意(我在问题中添加了错误页面)。等待用户点击会更好吗>
  • 您在发帖之前不知道/注意到这一点?本来可以节省您创建问题的时间,因为它根本与 jsf 无关(也可以节省我的时间;-))。如果您使用这个普通的 http 服务器错误页面,也会出现同样的问题。最佳解决方案取决于您。添加几秒钟的延迟或等待点击
  • 抱歉不完整,Kukeltje。不知何故,我意识到重定向是处理超时异常的正常方法。我不知道如何添加延迟 - 这正是我要问的。我想我应该用 http 或 html 标签发布
  • Uhhhh... 那么请了解content="0; 做了什么... minimal reproducible example... 总是... ;-)

标签: html jsf


【解决方案1】:

行为完全按照你告诉它的行为

 <meta http-equiv="refresh" content="0;url=#{request.contextPath}/index.xhtml" />

其中的content="0 表示:“不要等待,而是立即重定向”。将 0 更改为 10 将使其等待 10 秒,

<meta http-equiv="refresh" content="10;url=#{request.contextPath}/index.xhtml" />

实际上,这根本与 jsf 无关,而是纯 html。正常的 404 错误页面也会出现问题

【讨论】:

    猜你喜欢
    • 2018-02-18
    • 2012-08-14
    • 1970-01-01
    • 2012-10-13
    • 2013-09-20
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 2012-02-25
    相关资源
    最近更新 更多