title: How to navigate in JSF? How to make URL reflect current page (and not previous one)
body: <p>I am currently learning JSF and was rather amazed and puzzled when I realized that whenever we use <code>&lt;h:form&gt;</code>, the standard behavior of JSF is to always show me the URL of the <em>previous</em> page in the browser, as opposed to the URL of the <em>current</em> page. </p>
  
  <p>I understand that this has to do with the way JSF always posts a form to the same page and then just renders whatever page the controller gives it back to the browser which doesn't know the page location has changed.</p>
  
  <p><strong>It seems like JSF has been around for long enough that there must be a clean, solid way to deal with this. If so, would you mind sharing?</strong> </p>
  
  <p>I have found various workarounds, but sadly nothing that seems like a real solid solution.</p>
  
  <ul>
  <li>Simply accept that the URL is misleading.</li>
  <li>Append <code>"?faces-redirect=true"</code> to the return value of <em>every</em> bean's action and then
  <ul>
  <li>figure out how to replace <code>@RequestScoped</code> with something else (Flash Scopes, CDI conversation, @SessionScoped, ...).</li>
  <li>accept to have two HTTP round trips for every user action.</li>
  </ul></li>
  <li>Use some method (e.g. 3rd party library or custom code) to hide the page name in the URL, always using the same generic URL for every page.</li>
  </ul>
  
  <p>If <code>"?faces-redirect=true"</code> is as good as it gets, is there a way do configure an entire application to treat all requests this way?</p>