Thanks for the clarification...

-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 18, 2006 4:04 PM
To: MyFaces Discussion
Subject: Re: Simple <redirect/> appending jsf extension

Charbel Abdul-Massih wrote:
> Simon,
> 
> But I thought the whole point of the <redirect/> is to tell JSF that
the
> view-id is external...

No, redirect is really to tell the browser what the real URL of the 
target JSF page is.

With normal navigation, the browser POSTs a request to /page1.xhtml. If 
page1.xhtml then does "normal" navigation to /page2.xhtml that is 
implemented as an internal "forward" within the webserver. In this case,

the browser is showing the contents of page2.xhtml, but it doesn't know 
that: it posted to /page1.xhtml, so that is the url it displays, and 
will bookmark, and will use to resolve any relative URLs (eg to images, 
javascript, etc) contained in the page [1].

Usually this doesn't matter, but sometimes it does (esp. if you want to 
allow users to bookmark the page).

If you do care about the browser having the right url for a particular 
page, you need to use redirect. However that does have disadvantages, 
including a performance hit and the fact that because it is a different 
servlet request page1.xhtml cannot use request-scope variables to pass 
data to page2.xhtml.

[1] there is an HTML META tag that can be used to work around relative 
url resolution, but nothing to fix the bookmark issue..

Regards,

Simon

Reply via email to