| Author |
JSF Checkbox Group
|
Mark Gent
Greenhorn
Joined: May 20, 2010
Posts: 1
|
|
Hi,
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.
@EJB
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();
items.setValue(list);
CountryListID.getChildren().add(items);
return CountryListID;
}
Is there a similar method for checkboxes?
Thanks,
MG.
|
 |
 |
|
|
subject: JSF Checkbox Group
|
|
|