1

I know there are some advantages in using page forwarding as it is the default in JSF. I also know how to set redirect for some pages using 'faces-redirect' in the implicit navigation or the tag in the faces-config file. I searched a lot on internet but I didn't find an easy and straight way (such as a configuration parameter) to enable redirect for all pages. The reason I would like to use page redirect everywhere is the following: if every page is asked whit its url the container can be used for page authorization without the need of additional security library. Don't know if it can be a good idea, but performances are not an issue in this moment and using container security can save development time for the first release.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Filippo
  • 1,123
  • 1
  • 11
  • 28

1 Answers1

1

You can achieve this with a custom ConfigureableNavigationHandler. You can find a kickoff example in the answer to this question: JSF 2 and Post/Redirect/Get?

However, I have the feeling that you're designing page-to-page navigation the wrong way. You seem to be using POST requests for simple page-to-page navigation. If you fix them to be GET requests, then you don't need to worry about this. So, use <h:link> instead of <h:commandLink> for page-to-page navigation. This way you don't need to implement the PRG. See also When should I use h:outputLink instead of h:commandLink?

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • As stated in other questions I'm quite new to JSF and I'm developing an application based on Netbeans 7.0 wizard generated code. At first I thought the automatically generated code was the result of best practices, so I tried to follow its architecture and conventions, but after lots of headaches I start to believe it is not up to date with JSF 2.0. For example all page to page navigation is done with , and I thought it was the right way of implementing it. I will try to replace it but the legacy code is a lot... – Filippo Aug 18 '11 at 07:08