问题
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