从JSF页面获取请求和会话参数以及属性 [英] Get Request and Session Parameters and Attributes from JSF pages
问题描述
我正在将JSF与facelets一起使用,我需要在JSF页面中获取请求和会话参数.在JSP页面中,我得到了这样的参数:"${requestScope.paramName}"
或"${sessionScope.paramName}"
.但是现在使用JSF之后,只有bean,除了bean属性之外,您将无法获得任何值.
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.
注意:会话属性使用acegi安全性自动填充,因此我无法对其进行任何访问.
NOTE: The session attributes what I need is auto filled using acegi security so I can't get any access to them.
那现在该怎么办?
推荐答案
您可以使用表达式获取请求参数 id :
You can get a request parameter id using the expression:
<h:outputText value="#{param['id']}" />
- param -此请求的请求参数的不变映射,由 参数名称.每个参数名称仅包含第一个值.
- sessionScope -此请求的会话属性的映射,由 属性名称.
- 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.
JSF 1.0规范的第5.3.1.2节定义了以下对象:必须由变量解析器解析.
Section 5.3.1.2 of the JSF 1.0 specification defines the objects that must be resolved by the variable resolver.
这篇关于从JSF页面获取请求和会话参数以及属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!