I made enterprise application in Java ( NetBeans 8.2 ) that has 2 EJB modules and one web application which is based on JSF 2.2. The application is working in my NetBeans version, but when I transfer this application on another pc and deploy it there, it shows some errors. The place where problem is looks like this:
<h:selectManyListbox class = "selectManyListBox" id="parkiralista" value="#{pregled.odabranaParkiralista}" >
<f:ajax event="valueChange" execute="@this" render="" />
<f:selectItems value="#{pregled.popisParkiralista}"
var="p"
itemLabel="#{p.adresa.concat('; ').concat(p.naziv).concat('; ').concat(p.id.toString())}"
itemValue="#{p}"/>
</h:selectManyListbox>
So this itemValue="#{p}"/>
is object of type Parkiralista and I don't have any custom converter to convert it back into object. And this works on my pc even though I do not have a custom converter. But when I tranfer app on another pc and deploy it there it doesn't work and NetBeans shows this error: java.lang.String cannot be cast to org.foi.nwtis.ivicelig.ejb.eb.Parkiralista
. So my question is why this works on my first pc and not on my second pc . Does new version of JSF supports itemLabel with object and without converter?
Thanks.
Does new version of JSF supports
itemLabel withobjectandwithout converter?
That's correct. Since JSF 2.3, an explicit converter is not required for <h:selectManyXxx>
components bound to a List<T>
. This was implemented as part of spec issue 1422.
Apparently, you was actually running Java EE 8 / JSF 2.3 in one environment and Java EE 7 / JSF 2.2 in another environment. This is not a good way of developing applications. You should develop against the intended minimum supported version, in all development environments.