javax.faces.FacesException: java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.component.UIComponent

孤人 提交于 2019-12-01 19:59:43
BalusC

java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.component.UIComponent at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations

This particular exception will occur when you have a String value property like

private String value;

and are binding it to a component using the binding attribute:

<h:inputText binding="#{bean.value}" />

This is incorrect. The value should be bound using the value attribute:

<h:inputText value="#{bean.value}" />

The binding is only to be used to bind the whole component (which is an instance of UIComponent) to the backing bean, for example to programmaticlly modify it.

Verify your login.xhtml code. If necessary cut out as much as possible code as long as you can still reproduce the problem so that you can end up with the smallest possible code snippet which reproduces exactly this problem which should allow you to find the culprit easier.

See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!