I am new to JSF, I am getting the following error for <h:selectManyCheckBox>
:
Validation Error: Value is not valid
This is my model:
private List<String> selectedRoles;
public List<SelectItem> availableRolesSelectItem;
for (Role role : rolesList) {
SelectItem option = new SelectItem(role.getName(), role.getName() + " " + role.getDescription());
availableRolesSelectItem.add(option);
}
This is my view:
<h:selectManyCheckbox value="#{mybean.selectedRoles}" required="true" requiredMessage="#{errormessages.valueRequired}">
<f:selectItems value="#{mybean.availableRolesSelectItem}" />
</h:selectManyCheckbox>
In the SelectItem
I am not assigning Role
object as item value, I am just assigning a String
value. Even though I am getting the error.
Can you guys help me on this?