Evaluation of EL during view build time in c:forEach

半腔热情 提交于 2019-12-13 00:55:57

问题


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">

or

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

回答1:


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.

See also:

  • JSTL in JSF2 Facelets... makes sense?


来源:https://stackoverflow.com/questions/18801971/evaluation-of-el-during-view-build-time-in-cforeach

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!