I have Upgrade my project from JSFContainer 2.2 to JSFContainer 2.3
<p:selectManyListbox id="acl" value="#{controller.process.basisList}" >
<f:selectItems value="#{controller.filinglist}" />
</p:selectManyListbox>
filinglist has class object like ob(1L, 'data1'); basisList with generic type String
when working with JSFContainer 2.2, CDI 1.2 and EL 3.0. it's working fine the Long data has been stored as String in basisList List. I understand the this concept in below URL
But in JSFContainer 2.3, CDI 2.0 and EL 3.0. I got the below error
when I run the code
for(String i : basisList) {
System.out.println(i);
}
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String.
I debug using below code
for(Object i : basisList) {
System.out.println(i.getClass() + " > " + i);
}
The output what am getting is below
class java.lang.Long > 3
This behavior is correct when you upgrade from JSF 2.2 to JSF 2.3. Previously, JSF 2.2 and older didn't auto-convert these values which was actually not the expected behavior.
It's specified in
UISelectManyjavadoc for JSF 2.3.The emphasized section of the above blockquote is new since JSF 2.3 (to compare, here's the JSF 2.2 variant of
UISelectManyjavadoc).You need to fix your
basisListto become of exactly same type asfilinglist, or else you'll need to attach an explicitConverter.