I would like to understand what are the semantics behind appending the \"?faces-redirect=true\"
in the action property of a
t
Page-to-page navigation should not be performed using POST at all. You should be using normal <h:link>
or <h:button>
for this instead of <h:commandLink>
or <h:commandButton>
.
So instead of
<h:commandLink value="Next page" action=nextpage.xhtml?faces-redirect=true" />
you should actually be using
<h:link value="Next page" outcome="nextpage.xhtml" />
This has the major benefit that the website is now SEO friendly. Searchbots namely doesn't index forms.
Use the <h:commandLink>
only if you need to submit a form with some user input. But more than often the result is just presented in the same page, if necesary conditionally rendered/included. Only on successful submits which absolutely needs to go to a different page (e.g. login/logout), you should indeed be sending a redirect. This is the so-called Post-Redirect-Get pattern.