`

valueexpression的用法

    博客分类:
  • jsf
阅读更多
在1.2之前,可以向下面一样使用ValueBinding:
ValueBinding vb = facesContext.getApplication().createValueBinding("#{bindings}");
DCBindingContainer dc = (DCBindingContainer) vb.getValue(facesContext);

但是在JSF1.2中,需要这样使用:
/**
     * Method for taking a reference to a JSF binding expression and returning
     * the matching object (or creating it).
     * @param expression EL expression
     * @return Managed object
     */
    public static Object resolveExpression(String expression) {
        FacesContext facesContext = getFacesContext();
        Application app = facesContext.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesContext.getELContext();
        ValueExpression valueExp = 
            elFactory.createValueExpression(elContext, expression, 
                                            Object.class);
        return valueExp.getValue(elContext);
    }
    /**
     * Return the current page's binding container.
     * @return the current page's binding container
     */
    public static BindingContainer getBindingContainer() {
        return (BindingContainer)resolveExpression("#{bindings}");
    }
分享到:
评论

相关推荐

    JSP自定义标签rtexprvalue属性用法实例分析

    rtexprvalue的全称是 Run-time Expression Value, 它用于表示是否可以使用JSP表达式. 当在标签里指定<rtexprvalue>true时, 表示该自定义标签的某属性的值可以直接指定或者通过动态计算指定, 示例如下: <sql:...

    SQL中的ISNULL函数使用介绍

    ISNULL ( check_expression , replacement_value ) 参数 check_expression 将被检查是否为 NULL的表达式。check_expression 可以是任何类型的。 replacement_value 在 check_expression 为 NULL时将返回的表达式。...

    PHP中的函数– foreach()的用法详解

    复制代码 代码如下:foreach (array_expression as $value) statementforeach (array_expression as $key => $value) statement第一种格式遍历给定的 array_expression 数组。每次循环中,当前单元的值被赋给 $...

    esprima-to-value:将esprima ast objectliteral转换为真实对象

    用法 const esprima = require ( 'esprima' ) ; const toValue = require ( 'esprima-to-value' ) ; const ast = esprima . parse ( code ) ; console . log ( ast . body ) ; /** * [ * { type: 'Literal', value...

    PHP中foreach()用法汇总

    foreach (array_expression as $value) statement foreach (array_expression as $key => $value) statement 第一种格式遍历给定的 array_expression 数组。每次循环中,当前单元的值被赋给 $value 并且数组内部...

    详解PHP中foreach的用法和实例

    在PHP中经常会用到foreach的使用,而要用到foreach,就必须用到数组。因此,在这篇文章中,我们一边讲数组,一边讲foreach。 foreach有两种语法: ...foreach (array_expression as $key => $value)

    SQL语句中常用的函数大全

    CallByName (object, procname, usecalltype,[args()]) 执行一个对象的方法、设定或传回对象的属性。 CBool(expression) 转换表达式为Boolean 型态。 CByte(expression) 转换表达式为Byte 型态。 CChar(expression) ...

    freemarker语法完整版

    <#assign name1=value1 name2=value2 ... nameN=valueN> 或则 --> 或则 --> capture this 或则 --> capture this 用例 生成变量,并且给变量赋值 给seasons赋予...

    jmespath-ts:jmespath.js包的打字稿翻译

    search(data: JSONValue, expression: string): JSONValue /* using ES modules */ import { search } from '@metrichor/jmespath' ; /* using CommonJS modules */ const search = require ( '@metrichor/jmespath...

    uneval(var_name, value, return_cell_array):Uneval 执行 eval('expression') 的逆运算。-matlab开发

    人为的示例用法: settings = load('some_data.mat'); string = uneval('settings2', settings) eval(字符串); disp(isequalwithequalnans(settings, settings2)); 此函数可能不适用于嵌套函数的句柄、...

    浅谈SQLServer的ISNULL函数与Mysql的IFNULL函数用法详解

    ISNULL(check_expression,replacement_value) 1、check_expression与replacement_value的数据类型必须一致。 2、如果check_expression为NULL,则返回replacement_value。 3、如果check_expression为NULL,则返回check_...

    freemarker总结

    defaultValue,第一种用法不给缺失的变量指定默认值,表明默认值是空字符串,长度为0的集合,或者长度为0的Map对象. 使用!指定默认值时,并不要求默认值的类型和变量类型相同.使用??运算符非常简单,它总是返回一个布尔值...

    VBA-定位单元格

    其使用格式为:expression.SpecialCells(Type, Value) expression 是必需的,返回一个有效的对象。 type也是必需的,在打出括号之后会有提示。 参数 Value 是可选的,如果 Type 参数为 xlCellTypeConstants 或 xlCel

    基于方法的切片缓存插件Aspect-Cache-Plug.zip

    Aspect-Cache-Plug先介绍缓存使用下场景对同一请求(针对不同请求参数)进行缓存,可以减少服务器压力、加快响应速度查询接口:根据请求条件对返回结果进行缓存更新接口:根据条件对指定缓存进行清除@Aspect(key =...

    详解Python中的条件判断语句

    一个else语句可以使用if语句结合起来。如果在if语句中的条件表达式解析为0或false值,那么else语句包含代码执行。... print 1 - Got a true expression value print var1 else: print 1 - Got a f

    2009 达内Unix学习笔记

    用法 df [-F FSType] [-abeghklntVvZ] [-o FSType 特定选项] [目录 | 块设备 | 资源] df -k 以kbytes显示文件大小的查看文件系统方式 六、显示文件内容 more 分屏显示文件的内容。 用法 more [-cdflrsuw] [-行...

    Oracle事例

    1.增加主键 alter table TABLE_NAME add constraint KEY_NAME primary key (TABLE_COLUMN); 指定表空间 alter table TABLE_NAME add constraint KEY_NAME primary key (TABLE_COLUMN) using index tablespace ...

    EL表达式的详细使用

    例如,EL 表达式可以使用 ${requestScope.objectName} 访问一个 JSP 请求范围的对象,还可以使用 ${requestScope.objectName.attributeName} 访问对象的属性。 sessionScope 将会话范围的变量名称映射到其值。该...

    php遍历数组的4种方法总结

    在php中可以用来遍历数组的函数有很多,如有:for语句、list、each...foreach ( array_expression as $value ) statement /* array_expression是要遍历的数组  as作用是将数组的值赋给$value  statement是后续语句 */

    JSON-Grep:用于解析JSON文档的命令行工具和API

    jgrep可以作为gem来使用: gem install jgrep JGrep二进制用法: jgrep [expression] -i foo.json 或者 cat "foo.json" | jgrep [expression] 标志: -s, --simple [FIELDS] : Greps the JSON and only ...

Global site tag (gtag.js) - Google Analytics