Search code examples
jsfelmyfaces

jsf rendered not evaluated?


I want the checkbox only to be rendered, if the label is not empty.

<tr:panelCaptionGroup>
...
    <tr:selectBooleanCheckbox 
        id="XField1"
        render="#{!empty myController.form.model.XField1}"
        value="#{myController.form.model.XFieldChecked1}"
        text="#{myController.form.model.XField1}"
        simple="false" />
</tr:panelCaptionGroup>

XField1 is a String, XFieldChecked1 is a Boolean. It does not work, it always shows the checkbox, even if the string is null or "".

In that case, the output is (removed some attributes for clarity):

<table border="0" summary="" class="af_selectBooleanCheckbox" id="modelXField3__xc_">  
<tbody><tr>
  <td nowrap="" class="af_selectBooleanCheckbox_label"></td>
  <td valign="top" nowrap="" class="AFContentCell">
    <span id="modelXField3__xc_c" class="af_selectBooleanCheckbox_content">
      <input type="checkbox" value="t" name="modelXField3" id="modelXField3">
      <label for="modelXField3"></label>
    </span>
  </td>
</tr></tbody>
</table>

Solution

  • As for every other JSF UI component, the attribute name is rendered, not render.

    See also: