Meaningless Drivel is fun!*
The moose likes JSF and the fly likes JSF redirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF redirect" Watch "JSF redirect" New topic
Author

JSF redirect

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
Hi,

I read as

<redirect/> is an optional element which can be used to specify that the response is generated by the new view using redirect response rather than rendering the response as the current request. If we don't specify this element then the address bar shows the current page address even the response is generated by other page.


I have not understood what author meant. Why we have to use redirect within navigation-case of navigation rule within faces-config. Can you please advise. Any ideas, suggestions, links, resources, sample code highly appreciated. Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

Unlike most web frameworks, the URL isn't a direct connection to a fixed resource in JSF. It's more of a session handle, That's why you can go to "http://localhost/myapp/listPages.jsf", click a control or link to edit a page, and still see the "listpages.jsf" in the browser navigation control instead of the "editpage.jsf" that actually handles the editing function.

By using the <redirect /> navigation element, you can force the listpages.jsf URL to display instead, at the cost of some additional overhead.

There are 3 reasons why you might want to to do this:

1. You're obsessive about URLs showing up "right" and don't care that it will cost extra.

2. You want the actual URL so that people can bookmark it

3. You're using J2EE security. J2EE security is applied based on the incoming URL, not on the resources accessed by the URL, so someone who doesn't have edit privileges shouldn't be able to use the "listpages.jsf" URL case I mentioned up above as a security loophole.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF redirect
 
Similar Threads
Facelets: Clicking on a command link is displaying the URL of the previous request that was sent
JSF faces-redirect not working
JSP redirect
Javascript window.location DIV?
h:commandlink request uri does not change