附加到复选框按钮的标签的自然行为是在单击按钮(标签)时更改按钮的状态。
这适用于 JSF 和 Richfaces。
有没有办法让它在 Primefaces(3.5) 中工作而不涉及 javascript ?
这是一个错误吗?
<p:outputLabel for="checkbox" value="Select it:" />
<p:selectBooleanCheckbox id="checkbox" label="My label" value="#{bean.value}" />
最佳答案
它不能在普通 JSF 中开箱即用,但在 Primefaces 中是 itemLabel
属性应该这样做:
<p:selectBooleanCheckbox id="checkbox" itemLabel="My label" ... />
关于jsf-2 - p :selectBooleanCheckbox and the label attached to it,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15062751/