jsf中的redirect和JSP中的sendRedirect之间的区别

发布于 2024-10-04 17:25:02 字数 561 浏览 1 评论 0原文

在我的应用程序中,我使用 JSF。我想 将用户重定向到错误页面 当他们的会话到期时。我有 尝试使用 标签 带有导航案例的 faces-config。它是 无法正常工作。它改变了 url,但页面未加载 ajax 请求。但如果我使用 HttpServletRespose 类的 sendRedirect 方法,它就可以正常工作。两者有什么区别?

这是faces-config文件中的代码,

 <navigation-rule>
    <navigation-case>
        <from-outcome>session_expired</from-outcome>
        <to-view-id>/pages/general/home.jsp</to-view-id>
        <redirect />
    </navigation-case>
</navigation-rule>

感谢您的快速回复。

In my application I use JSF. I want
to redirect the user to error page
when their session expires. I have
tried by using <redirect /> tag in
faces-config with navigation case. It's
not working properly. It changes the
url, but the page is not loaded for
ajax requests. But if I use sendRedirect method of HttpServletRespose Class it's working properly. What is the difference between the both?

This is the code in faces-config file,

 <navigation-rule>
    <navigation-case>
        <from-outcome>session_expired</from-outcome>
        <to-view-id>/pages/general/home.jsp</to-view-id>
        <redirect />
    </navigation-case>
</navigation-rule>

Thanks for you quick reply.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文