JSF 页面导航:如果 A.jsf 通过超链接导航到 B.jsf,为什么 URL 显示 A.jsf 而不是 B.jsf

发布于 2024-09-27 04:18:10 字数 1081 浏览 0 评论 0原文

如果 A.jsf 有一个 commandLink 可以导航到 B.jsf,那么我会认为当我在页面 B 时。 jsf,我看到 http:domain/host/project/B.jsf 作为 URL。但是,我在地址栏上看到 http:domain/host/project/A.jsf在导航控件中显示 URL 时,我总是落后一员。有办法解决这个问题吗?我的导航控件位于faces-config.xml 内。

按照 Plaudit Design - Web Design 建议尝试一下。但是并没有修复它。

<navigation-rule>
    <from-view-id>/CentralFeed.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>CREATE EVENT</from-outcome>
        <to-view-id>/CreateEvent.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>CREATE ARTICLE</from-outcome>
        <to-view-id>/WriteArticle.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>PROFILE</from-outcome>
        <to-view-id>/Profile.xhtml</to-view-id>
    </navigation-case>
    <redirect/>
</navigation-rule>

If A.jsf have a commandLink that will navigation to B.jsf, then I would think when I am at page B.jsf, I see http:domain/host/project/B.jsf as the URL. However, I see http:domain/host/project/A.jsf on my address bar. I am always ONE behind when displaying the URL in navigation control. Is there away to fix this? My navigation control is handle inside faces-config.xml.

Try this like Plaudit Design - Web Design suggest. However does not fix it.

<navigation-rule>
    <from-view-id>/CentralFeed.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>CREATE EVENT</from-outcome>
        <to-view-id>/CreateEvent.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>CREATE ARTICLE</from-outcome>
        <to-view-id>/WriteArticle.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>PROFILE</from-outcome>
        <to-view-id>/Profile.xhtml</to-view-id>
    </navigation-case>
    <redirect/>
</navigation-rule>

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凶凌 2024-10-04 04:18:10

您需要在导航规则中添加以下内容

<redirect/>

如果没有重定向元素,则重定向是内部的。重定向会导致外部重定向,因此您的浏览器会请求新页面。

You need to add the following inside your navigation-rule

<redirect/>

With out the redirect element the redirect is internal. The redirect causes an external redirect so your browser requests the new page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文