An Error Occurred: java.util.ArrayList cannot be cast to javax.faces.component.UIComponent solution


If you get the following exception when you try to bind the JSF Components to the ArrayList

just change the binding attribute of the component to value attribute such as the following solution

wrong –> <h:dataTable bgcolor=”red” binding=”#{EmployeeGenerator.employees}” var=”employee”

this works –> <h:dataTable bgcolor=”red” value=”#{EmployeeGenerator.employees}” var=”employee”

An Error Occurred: java.util.ArrayList cannot be cast to javax.faces.component.UIComponent – Stack Trace java.lang.ClassCastException: java.util.ArrayList cannot be cast to javax.faces.component.UIComponent at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1912) at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1132) at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:497) at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:157) at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98) at

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s