Get Request and Session Parameters and Attributes from JSF pages

Saeed picture Saeed · Feb 15, 2009 · Viewed 235.4k times · Source

I'm using JSF with facelets and I need to get the request and session parameters inside the JSF page. In JSP pages I got this parameter like that: "${requestScope.paramName}" or "${sessionScope.paramName}". But now after using JSF there are only beans and you can't get any value except bean attributes.

NOTE: The session attributes what I need is auto filled using acegi security so I can't get any access to them.

So what to do now?

Answer

McDowell picture McDowell · Feb 15, 2009

You can get a request parameter id using the expression:

<h:outputText value="#{param['id']}" />
  • param—An immutable Map of the request parameters for this request, keyed by parameter name. Only the first value for each parameter name is included.
  • sessionScope—A Map of the session attributes for this request, keyed by attribute name.

Section 5.3.1.2 of the JSF 1.0 specification defines the objects that must be resolved by the variable resolver.