title: Automatically include view parameters in URL
body: <p>I have simple jsf page with view params and load method which is processing those params:</p>
  
  <pre><code>&lt;f:metadata&gt;
   &lt;f:viewParam name="param1" value="#{bean.param1}"/&gt;
   &lt;f:viewParam name="param2" value="#{bean.param2}"/&gt;
   &lt;f:viewParam name="param3" value="#{bean.param3}"/&gt;
   &lt;f:event type="preRenderView" listener="#{bean.load()}"/&gt;
  &lt;/f:metadata&gt;
  </code></pre>
  
  <p>I also set some initial values in <code>@PostConstruct</code>.
  How to redirect user to new location that include those parameters (which are not null).
  For example user enter in browser:</p>
  
  <pre><code>domain.com/page.jsf
  </code></pre>
  
  <p>and is redirected to:</p>
  
  <pre><code>domain.com/page.jsf?param1=valueA
  </code></pre>
  
  <p>because param1 was set in <code>@PostConstruct</code>.</p>
  
  <p>Another question - I have links on page referencing same view:</p>
  
  <pre><code>&lt;h:link value="clickme"&gt;
   &lt;f:param name="param3" value="otherValue"/&gt;
  &lt;/h:link&gt;
  </code></pre>
  
  <p>When user enters page with <code>?param1=someValue</code> and clicks link, got redirected to <code>?param3=otherValue</code> but I want to redirect to <code>?param1=someValue&amp;param3=otherValue</code>.
  I know I can add more parameters in <code>&lt;h:link&gt;</code> but it's diffucult to add every possible param in every <code>&lt;h:link&gt;</code></p>
  
  <p>PS. I use BalusC tip from this topic <a href="https://stackoverflow.com/questions/5416070/jsf-2-and-post-redirect-get">JSF 2 and Post/Redirect/Get?</a></p>