Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The request parameters are available by <a href="http://docs.oracle.com/javaee/6/api/javax/faces/context/ExternalContext.html#getRequestParameterMap%28%29" rel="nofollow"><code>ExternalContext#getRequestParameterMap()</code></a>.</p> <pre><code>Map&lt;String, String&gt; params = externalContext.getRequestParameterMap(); // ... </code></pre> <p>Or if your application uses same parameter name with multiple values (which is usually the case for <code>&lt;h:selectManyXxx&gt;</code> components), use <a href="http://docs.oracle.com/javaee/6/api/javax/faces/context/ExternalContext.html#getRequestParameterValuesMap%28%29" rel="nofollow"><code>ExternalContext#getRequestParameterValuesMap()</code></a> instead</p> <pre><code>Map&lt;String, String[]&gt; params = externalContext.getRequestParameterValuesMap(); // ... </code></pre> <p>Please note that this only returns the parameters of the <strong>current</strong> request, not of the initial request in case of postbacks.</p> <p>As to the <a href="http://docs.oracle.com/javaee/6/api/javax/faces/context/ExternalContext.html#getRequest%28%29" rel="nofollow"><code>ExternalContext#getRequest()</code></a>, it returns in case of JSF applications running on a servlet container an instance of <a href="http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html" rel="nofollow"><code>HttpServletRequest</code></a> which you'd need to cast, but you should rarely have the need to get it. The <a href="http://docs.oracle.com/javaee/6/api/javax/faces/context/ExternalContext.html" rel="nofollow"><code>ExternalContext</code></a>, while following the Facade design pattern, has a lot of methods which are delegating to the underlying raw HTTP servlet request, session and context. You'd namely ultimately like to end up with <em>zero</em> <code>javax.servlet</code> imports in your backing beans.</p> <hr> <p><strong>Update</strong> as per your comment, you actually want to get only the view parameters which are been registered by <code>&lt;f:viewParam&gt;</code>. You can get them by <a href="http://docs.oracle.com/javaee/6/api/javax/faces/view/ViewMetadata.html#getViewParameters%28javax.faces.component.UIViewRoot%29" rel="nofollow"><code>ViewMetadata#getViewParameters()</code></a> wherein you pass the current <code>UIViewRoot</code>.</p> <pre><code>Collection&lt;UIViewParameter&gt; viewParameters = ViewMetadata.getViewParameters(FacesContext.getCurrentInstance().getViewRoot()); // ... </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload