jsf in action 笔记:潜藏对象(Implicit Variables)--2008.04.09

本文详细对比了JSF表达式语言(EL)与JSP 2.0 EL中可用的隐式变量,这些变量为开发者提供了方便快捷地访问常见对象的方法,如应用程序范围变量、HTTP头部信息等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2008.04.09 摘自 JSF in action 2.4.2 Using implicit variables   Page/115

Table 2.6 The JSF EL supports implicit variables for accessing commonly used objects. Most of the
same variables are supported by the JSP 2.0 EL.

 Implicit variableDescription Example Supported
in JSP 2.0
EL? 

 applicationScope

 A Map of application-scoped variables,
keyed by name.

 #{application-
Scope.myVariable}

 Yes

 cookie

 A Map of cookie values for the
current requested, keyed by
cookie name.

#{cookie.myCookie} 

Yes 

 facesContext

 The FacesContext instance for
the current request.

 #{facesContext}

 No

 header

 A Map of the HTTP header values
for the current request, keyed by
header name. If there are multiple
values for the given header
name, only the first is returned.

#{header['User-Agent']} 

 Yes

 headerValues

 A Map of the HTTP header values
for the current request, keyed by
header name. For each key, an
array of Strings is returned (so
that all values can be accessed).

 #{headerValues['Accept-
Encoding'][3]}

Yes 

 initParam

 A Map of the application initialization
parameters, keyed by
parameter name. (These are also
known as servlet context initialization
parameters, and are set in
the deployment descriptor).

 #{initParam.adminEmail}

 Yes

 param

A Map of the request parameters,
keyed by header name. If there
are multiple values for the given
parameter name, only the first is
returned. 

 #{param.address}

 Yes

 paramValues

 A Map of the request parameters,
keyed by header name. For each
key, an array of Strings is
returned (so that all values can
be accessed).

#{param.address[2]} 

Yes 

 requestScope

 A Map of request scoped variables,
keyed by name.

#{requestScope.user-
Preferences} 

Yes 

 sessionScope

 A Map of session scoped variables,
keyed by name.

 #{sessionScope['user']}

 Yes

 view

 The current view.

#{view.locale} 

No 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值