I'm not novice to java , but today i sucked to a problem for 1 hour, i don't know why .
My code looksas follows:
My ArrayList:
private ArrayList<Theme> selectedThemes;
My Loop:
for (Theme selectedTheme : selectedThemes) {
System.out.println(selectedTheme.getNom());
}
When i try to execute the code below , i receive this exception:
java.lang.ClassCastException: java.lang.String cannot be cast to com.mycompany.ecommerce.Modele.Catalogue.Theme
What i understand from the exception is that selectedTheme are String , it is very werd for me.
Note that when i execute this code :
System.out.println(selectedThemes);
it show the object of the list normally.
Edit
I'm not sure if this code could have relation with my issues:it's a SelectManyMenu that has relation with my ArrayList
<p:selectManyMenu id="advanced" value="#{jsfClient.selectedThemes}"
var="t" showCheckbox="true">
<f:selectItems value="#{jsfClient.themes}" var="theme" itemLabel="#{theme.nom}" itemValue="#{theme}" />
<p:column>
<h:outputText styleClass="ui-theme ui-theme-#{t.nom}" />
</p:column>
<p:column>
<h:outputText value="#{t.nom}" />
</p:column>
</p:selectManyMenu>
jsfClient is the ManagedBean. Any Help please , thank you.