aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Checkbox Group" Watch "JSF Checkbox Group" New topic
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF Checkbox Group
 
Similar Threads
Populated UISelect components via Database
Using disabled attribute in SelectOneMenu
populate selectOneMenu with list containing various type of object
JSF does not call action in managed bean
JSF drop down.