【发布时间】:2012-04-13 08:15:50
【问题描述】:
来自像这样的网页,
http://www.jsftutorials.net/components/step5.html
我了解JSF标签/视图组件中的绑定属性是将视图组件绑定到后台bean中UI组件的Java实例。
例如,下面的代码就是这样做的:
<h:inputText value="#{ myBean.someProperty}" binding="#{ myBean.somePropertyInputText}"/>
但有时我看到code like this:
<h:commandButton id="t1" binding="#{foo}" value="Hello, World!" onclick="alert('I am #{id:cid(foo)}'); return false;" />
其中id:cid是一个taglib函数,定义如下:
public static String cid(UIComponent component) {
FacesContext context = FacesContext.getCurrentInstance();
return component.getClientId(context);
}
在上面的代码中,binding="#{foo}" 没有绑定到“支持 bean 中 UI 组件的 Java 实例”。
那么binding="#{foo}"这样的表达是什么意思呢?
【问题讨论】:
标签: jsf binding jsf-2 components el