Im having trouble writing some feature in a huge EJB JSF Project: I need an Array of Strings shown in the GUI/html,
<h:outputText value="#{lastDaysName[0]}"/></f:facet>
works fine, but
<h:outputText value="#{lastWeeksName[0]}"/></f:facet>
throws an Exception:
javax.ejb.EJBTransactionRolledbackException: [Ljava.lang.String; cannot be cast to javax.faces.model.DataModel
i have defined both arrays the same way in my bean(the local interface and the class):
@DataModel
private String[] lastDaysName;
@DataModel
private String[] lastWeeksName;
both with a factory method:
@Factory("lastWeeksName")/ @Factory("lastDaysName")
and both have getter and setter methods(defined in interface and bean)
Where is my Fault??? I had a similar problem with ArrayList(again defined two fields in the class and one worked but as soon as i used the second in my xhtml file i got the cast exception) and the solution i found was to change the type of my field to List, i still dont know why it worked but it does...
Ive seen solutions like: "change the type of your list to an array of beans", bot that would be total overkill for a list/array of strings...