0

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>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Thang Pham
  • 38,125
  • 75
  • 201
  • 285

1 Answers1

3

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.

Plaudit Design
  • 1,156
  • 8
  • 16
  • It does not work for me. I edit my post with some codes, can u take a look at it? – Thang Pham Oct 11 '10 at 20:05
  • 1
    It should go inside the navigation case. Note that any request scoped beans will be recreated. Also, if no business action is involved, I'd suggest to just use `h:outputLink`. That's also more SEO friendly. Or if you're already on JSF 2.0, use `h:link` instead. – BalusC Oct 11 '10 at 20:54
  • Can u explain to me what is it mean by internal redirect and external redirect? – Thang Pham Nov 04 '10 at 02:07
  • 2
    By "internal redirect" I mean the server decides internally to display the page B.jsf even though the page requested by the browser was A.jsf. The browsers location bar shows what was requested. Adding the instructs JSF to respond with a "Location:" header which tells the browser to make new request for B.jsf. – Plaudit Design Nov 05 '10 at 13:48