title: How to get parameters from the URL in JSF properly?
body: <p>I believe there are 2 ways to get the parameters from the URL in JSF.</p>
  
  <p>One being in the bean:</p>
  
  <pre><code>Map&lt;String, String&gt; params =FacesContext.getCurrentInstance().
                     getExternalContext().getRequestParameterMap();
  String parameterOne = params.get("parameterOne");
  </code></pre>
  
  <p>and the other one being in the facelets page</p>
  
  <pre><code>&lt;f:metadata&gt;
      &lt;f:viewParam name="parameterOne" value="#{bean.parameterOne}"/&gt;
  &lt;/f:metadata&gt;
  </code></pre>
  
  <p>Obviously the latter one will require a field in the class and getter / setter for it. </p>
  
  <p>Besides that, what are the differences between these 2 different approaches? Which one should be preferred? </p>