On 3/2/06, Anthony Hong <[EMAIL PROTECTED]> wrote:
> In this example, click button in inputname.jsp can change page to
> greeting.jsp, but the url in IE has no change, means it is as same
> "inputname.jsp", click link in greeting.jsp to goodbye.jsp, url in IE
> is "greeting.jsp"
> Seams it is always one step after current page. it works fine by click
> link. but if I refresh current page, it displayed previous page not
> current page.
> This can be solved by add <redirect/> in each navigation-case. But why
> default action has such problem? What is the purpose?

JSF is not a url-centric system.   The only url that matters is the
one that initially gets you to a page.   As you note, the only way to
"force" a new url to display is to use <redirect/>, which will cause
you to lose any t:saveState or messages data (because a redirect
causes two page requests).

The "why" is because any action taken on a page causes a post to the
same location, and the location is the same page name as the one you
came from as it's the only page capable of interpreting your action.  
A redirect causes a second page request to occur which can "fix" your
url if that's something you care about.   However, that's not normally
a concern.   Other related frameworks (like WebObjects, for instance)
don't even bother to make the urls have meaning:

https://domain/cgi-bin/WebObjects/Application.woa/1/wo/S5q791dgut93QDw3lS1ut0/1.1.25

I think JSF probably could have saved some confusion by doing the same
thing so people didn't think the urls displayed in the browser are
relevent to the response rendered.

I have also set up similar systems under Struts when I've implemented
a StateManager to handle back button requests.  For instance, here's a
Struts URL :)

https://domain/application/kqTDWXI4OgKkieWEnFIh1wcv1ZjQnbN85hU_1.5.psc

"Meaningful" URLs are only useful when they can be reused.   If your
JSF application is in such a state that it can reuse the URL (ie, no
previous state or messages saved), then all you need to do is throw in
a <redirect/> to formally specify that, and the URL will be
"meaningful" in the browser.

Reply via email to