• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF redirect

 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic