在c:forEach中的视图构建期间对EL的评估 [英] Evaluation of EL during view build time in c:forEach

查看:130
本文介绍了在c:forEach中的视图构建期间对EL的评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c:forEach循环的视图构建时间内,EL语句会发生什么情况.

What happens with EL statements in a view build time in c:forEach loop.

<c:forEach var="v" values="#{bean.values}">
    <p:inputText value="#{v.name}" />
</c:forEach>

class Bean {
   public List<Pojo> getValues();
}

class Pojo {
   public void setName (String);
   public String getName();
}

如何评估此代码的渲染效果?要:

How will be this code evaluated for render? To:

 <p:inputText value="John Smith">

 <p:inputText value="#{pojo.name}" >

推荐答案

对于UI组件,在视图构建期间仅立即评估idbinding属性.所有其他属性都被推迟. IE.他们将获得 ValueExpression 的实例(或 MethodExpression ),而不是立即进行评估价值.在每个getValue()/setValue()调用中都会重新评估ValueExpression.

For UI components, only id and binding attributes are immediately evaluated during view build time. All other attribtues are deferred. I.e. they will get an instance of ValueExpression (or MethodExpression) instead of the immediately evaluated value. The ValueExpression is re-evaluated on every individual getValue()/setValue() call.

这篇关于在c:forEach中的视图构建期间对EL的评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆