JSF selectBooleanCheckbox always checked

267 Views Asked by At

Good afternoon in my timezone.

<ui:repeat id="situacoes-edit-list" var="situacao" varStatus="loop" value="#{cc.attrs.managedBean.situacoesEditDTO}">
        <tr  id="sitEdit#{situacao.situacaoId}" class="situations">
             <td colspan = "2">#{situacao.situacaoNome}</td>
        </tr>
  <ui:repeat id="justificacoes-list" var="justificacao" varStatus="innerLoop" value="#{situacao.justificacoes}">
      <tr id="jusEdit#{justificacao.justificacaoId}" class="justifications">
          <td>
              <h:selectBooleanCheckbox  binding="#{chkJust}" id="chk-just-#{chkJust.clientId}" value="#{justificacao.selected}" />
            </td>
             <td>#{justificacao.selected}</td>
      </tr>
  </ui:repeat>
</ui:repeat>

In the Bean the the get and set methods are the follow:

 public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

The resulting HTML

 <tr id="jusEdit6" class="justifications">
      <td><input id="container-edit-form:intervencaoJustificacoes:situacoes-edit-list:0:justificacoes-list:0:chk-just-j_id3" type="checkbox" name="container-edit-form:intervencaoJustificacoes:situacoes-edit-list:0:justificacoes-list:0:chk-just-j_id3" checked="checked" />
       </td>
       <td>false</td>
 </tr>
 <tr id="jusEdit2" class="justifications">
       <td><input id="container-edit-form:intervencaoJustificacoes:situacoes-edit-list:0:justificacoes-list:1:chk-just-j_id3" type="checkbox" name="container-edit-form:intervencaoJustificacoes:situacoes-edit-list:0:justificacoes-list:1:chk-just-j_id3" checked="checked" />
       </td>
       <td>true</td>
</tr>

As you see the <td>#{justificacao.selected}</td> returns the correct value but the value="#{justificacao.selected}" does not produce the correct behaviour. Why is this happening ? I am using Mojarra 2.0.1

Thanks in advance Best regards

0

There are 0 best solutions below