1 Reply Latest reply on May 5, 2011 4:11 AM by Lukáš Fryč

    Align dynamic manycheckbox

    Eswara MoorthyNEC Newbie



            I used <h:selectManyCheckbox> component.


      If i use this component, all checkboxes displayed in single line(layout=pageDirection).

      otherwise allcheckboxes displyed one by one(layout=lineDirection)



      But i want display, first line three checkboxes and second line three checkboxes, third line three checkboxes and so on...



      <h:selectManyCheckbox id="checkBoxesId"
                            rendered="#{CheckBox2.choices != null and not empty CheckBox2.choices}">
               <f:selectItems value="#{CheckBox2.choices}" />


      Bean : CheckBox2.java


      import java.util.ArrayList;
      import java.util.List;
      import javax.faces.model.SelectItem;
      public class CheckBox2
          private String[] selectedChoices;
          private List<SelectItem> choices;
          public CheckBox2()
              choices = new ArrayList<SelectItem>();
              choices.add(new SelectItem("First"));
              choices.add(new SelectItem("Second"));
              choices.add(new SelectItem("Third"));
              choices.add(new SelectItem("Fourth"));
              choices.add(new SelectItem("Fifth"));
              choices.add(new SelectItem("Sixth"));
              choices.add(new SelectItem("Seventh"));
              choices.add(new SelectItem("Eight"));
              choices.add(new SelectItem("Nine"));               
          public String[] getSelectedChoices(){        return selectedChoices;
          public void setSelectedChoices(String[] selectedChoices){
              this.selectedChoices = selectedChoices;
          public List<SelectItem> getChoices(){        return choices;
          public void setChoices(List<SelectItem> choices){
              this.choices = choices;


      Totally i have 9 checkboxes. I want display three check boxes perline,


      Any other way to implement this


      Help me.

      Thanks in advance.