p:selectBooleanCheckbox和附加到它的标签

amb*_*amb 7 primefaces jsf-2

附加到复选框按钮的标签的自然行为是在单击按钮(标签)时更改按钮的状态.这适用于JSF和Richfaces.

有没有办法让它在Primefaces(3.5)中工作而不涉及javascript?这是一个错误吗?

<p:outputLabel for="checkbox" value="Select it:" />
<p:selectBooleanCheckbox id="checkbox" label="My label" value="#{bean.value}" />
Run Code Online (Sandbox Code Playgroud)

Mat*_*ndy 15

它在普通的JSF中没有开箱即用的功能,但在Primefaces中itemLabel属性应该这样做:

<p:selectBooleanCheckbox id="checkbox" itemLabel="My label" ... />
Run Code Online (Sandbox Code Playgroud)