Reputation: 6813
I have the following problem when i use the selectManyCheckBox:
campaignInformationForm.campaignInformation.googleAnalytics (this are boolean objects)
java.lang.Boolean cannot be cast to javax.faces.model.SelectItem
and my code is:
<ice:selectManyCheckbox id="options" layout="pageDirection" >
<f:selectItem itemValue="#{campaignInformationForm.campaignInformation.googleMerchantAccount}" itemLabel="#{msgs['page.information.GoogleAccount']}" />
<f:selectItem itemValue="#{campaignInformationForm.campaignInformation.googleMap}" itemLabel="#{msgs['page.information.GoogleMap']}" />
<f:selectItem itemValue="#{campaignInformationForm.campaignInformation.googleAnalytics}" itemLabel="#{msgs['page.information.GoogleAnalytics']}" />
</ice:selectManyCheckbox>
Any ideas?
Edit:
This is my DTO
public class CampaignInformation implements Serializable{
.....BOILERPLAIT CODE ...
private boolean googleMerchantAccount;
private boolean googleMap;
private boolean googleAnalytics;
.....GETTER/SETTER ...
And i want a checkbox that can work with those boolean select/deselect according to their value, can it be done??
Upvotes: 0
Views: 2090
Reputation: 2728
The f:selectItem tags in your example here are correct. I'm almost sure you used "value" instead of "itemValue" in one selectItem (perhaps you deleted one for a clean example?).
Also, where will the selection be stored? I guess you should have a "value" property (really, this time) in ice:selectManyCheckbox, like this:
<ice:selectManyCheckbox id="options" layout="pageDirection" value="#{campaignInformationForm.selectedItems}">
<f:selectItem itemValue="#{campaignInformationForm.campaignInformation.googleMerchantAccount}" itemLabel="#{msgs['page.information.GoogleAccount']}" />
<f:selectItem itemValue="#{campaignInformationForm.campaignInformation.googleMap}" itemLabel="#{msgs['page.information.GoogleMap']}" />
<f:selectItem itemValue="#{campaignInformationForm.campaignInformation.googleAnalytics}" itemLabel="#{msgs['page.information.GoogleAnalytics']}" />
</ice:selectManyCheckbox>
(selectedItems being a List or array of selected items)
Upvotes: 3