1 Reply Latest reply on Feb 20, 2011 6:38 PM by Tim Evers

    how to use h:selectBooleanCheckbox

    wadhah jebri Newbie

      how to use h:selectBooleanCheckbox this is my selectBooleanCheckbox tag :




      <h:selectBooleanCheckbox  value="#{myBean.uiSelectBoolean}" />


      This is my bean :




      @Stateless
      @Name("myBean")
      public class MyClassBean implements MyClass {
           @Logger
           private Log log;
           @In
           StatusMessages statusMessages;
           @PersistenceContext
           private EntityManager entityManager;
           private UISelectBoolean uiSelectBoolean = null;
      
           public UISelectBoolean getUiSelectBoolean() {
                return uiSelectBoolean;
           }
      
           public void setUiSelectBoolean(UISelectBoolean uiSelectBoolean) {
                this.uiSelectBoolean = uiSelectBoolean;
           }
      
           public void myMethod(Object object) {
                if (uiSelectBoolean.isSelected()) {
                     object.setDispached(true);
                     entityManager.merge(object);
                }
           }
      }
      
      



        • 1. Re: how to use h:selectBooleanCheckbox
          Tim Evers Master

          Read the doco before posting.


          Just like almost all other components the value attribute should map to a VALUE not a component.


          @Stateless
          @Name("myBean")
          public class MyClassBean implements MyClass {
               @Logger
               private Log log;
          
               @In
               StatusMessages statusMessages;
          
               @PersistenceContext
               private EntityManager entityManager;
          
               private Boolean checkBoxValue = Boolean.TRUE;
          
               public Boolean getCheckBoxValue() {
                      return this.checkBoxValue;
                  }
          
                  public void setCheckBoxValue(Boolean value) {
                      this.checkBoxValue = value;
                  }
          
          }
          



          <h:selectBooleanCheckbox  value="#{myBean.checkBoxValue}" />