从 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屋!