File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF Checkbox Group Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Checkbox Group" Watch "JSF Checkbox Group" New topic

JSF Checkbox Group

Mark Gent

Joined: May 20, 2010
Posts: 1

I am new to JSF and am trying to create a set of check boxes up froom my backing bean.

I currenty have a List of the records from my JPA enitity via my Local interface.

private RoleCodeLocal rcObj;
protected List<Rolecode> RolecodeLister;
this.RolecodeLister = rcObj.getAllItems();

public List<Rolecode> getRolecodeLister() {return this.RolecodeLister;}
public void setRolecodeLister(List<Rolecode> value){this.RolecodeLister = value;}

The data is only in 2 columns ID, and Name say. How do I now get this data set into a checkbox group?

<h:selectManyCheckbox disabledClass="selectManyCheckbox_Disabled"
styleClass="selectManyCheckbox" id="PartyRoles"></h:selectManyCheckbox>

I have set up a select item using a similar technique but then binding as below:

<h:selectOneMenu binding="#{pc_Create_addressbook.countryListID}" id="CountryID" value="#{pc_Create_addressbook.countryID}"></h:selectOneMenu>

public HtmlSelectOneMenu getCountryListID()
CountryListID = new HtmlSelectOneMenu();

final Collection<SelectItem> list = new ArrayList<SelectItem>();
for (Country c : CountryLister)
list.add(new SelectItem(c.getId(), c.getName()));
final UISelectItems items = new UISelectItems();
return CountryListID;

Is there a similar method for checkboxes?


I agree. Here's the link:
subject: JSF Checkbox Group
It's not a secret anymore!