IllegalArgumentException:无法将类型 class java.util.HashSet 的 [] 转换为 class xxx
IllegalArgumentException: Cannot convert [] of type class java.util.HashSet to class xxx
我发现自己遇到了 JSF 错误,但不知道为什么会这样。我给你看视图部分:
<rich:extendedDataTable id="objects" value="#{newObjectsBean.objectsList}"
selection="#{newObjectsBean.objectToDelete}"
rendered="#{newObjectsBean.anyResult}"
selectionMode="single" var="item" rows="10" >
<a4j:ajax execute="@form" event="selectionchange"
listener="#{newObjectsBean.selectionListener}" render="deletionButton"/>
<rich:column width="125px" sortBy="#{item.sId}"
sortOrder="#{fragSortingBean.sortsOrders['sId']}">
<f:facet name="header">
<h:panelGrid columns="2" cellpadding="0" cellspacing="2"
style="text-align: left; height: 30px">
<a4j:commandLink execute="@this" value="id" render="objects"
action="#{fragSortingBean.sort}">
<f:param name="sortProperty" value="sId"/>
</a4j:commandLink>
<h:graphicImage value="../../resources/images/arrow_sort_down.png"
rendered="#{fragSortingBean.sortsOrders['sId']=='descending'}"/>
<h:graphicImage value="../../resources/images/arrow_sort_up.png"
rendered="#{fragSortingBean.sortsOrders['sId']=='ascending'}"/>
</h:panelGrid>
</f:facet>
<h:outputText id="ssaId" value="#{item.sId}"/>
</rich:column>
然后这些项目是一个对象列表 (MyObjectBean),只有三个属性(及其对应的 getter / setter)
问题轨迹如下:
java.lang.IllegalArgumentException: Cannot convert [] of type class java.util.HashSet to class xxx.yyy.zzz.entities.MyObjectBean
at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:397)
at com.sun.el.parser.AstValue.setValue(AstValue.java:194)
at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:286)
at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:88)
at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:124)
at org.richfaces.renderkit.SortingFilteringRowsRenderer.updateAttribute(SortingFilteringRowsRenderer.java:142)
at org.richfaces.renderkit.SelectionRenderer.doDecode(SelectionRenderer.java:175)
at org.richfaces.renderkit.ExtendedDataTableRenderer.doDecode(ExtendedDataTableRenderer.java:805)
at org.richfaces.renderkit.RendererBase.decode(RendererBase.java:80)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:790)
at org.richfaces.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:816)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIForm.processDecodes(UIForm.java:216)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:941)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
有线索吗?
提前致谢
@EDT 的选择必须评估为一个集合,看起来你的指向单个对象。
我发现自己遇到了 JSF 错误,但不知道为什么会这样。我给你看视图部分:
<rich:extendedDataTable id="objects" value="#{newObjectsBean.objectsList}"
selection="#{newObjectsBean.objectToDelete}"
rendered="#{newObjectsBean.anyResult}"
selectionMode="single" var="item" rows="10" >
<a4j:ajax execute="@form" event="selectionchange"
listener="#{newObjectsBean.selectionListener}" render="deletionButton"/>
<rich:column width="125px" sortBy="#{item.sId}"
sortOrder="#{fragSortingBean.sortsOrders['sId']}">
<f:facet name="header">
<h:panelGrid columns="2" cellpadding="0" cellspacing="2"
style="text-align: left; height: 30px">
<a4j:commandLink execute="@this" value="id" render="objects"
action="#{fragSortingBean.sort}">
<f:param name="sortProperty" value="sId"/>
</a4j:commandLink>
<h:graphicImage value="../../resources/images/arrow_sort_down.png"
rendered="#{fragSortingBean.sortsOrders['sId']=='descending'}"/>
<h:graphicImage value="../../resources/images/arrow_sort_up.png"
rendered="#{fragSortingBean.sortsOrders['sId']=='ascending'}"/>
</h:panelGrid>
</f:facet>
<h:outputText id="ssaId" value="#{item.sId}"/>
</rich:column>
然后这些项目是一个对象列表 (MyObjectBean),只有三个属性(及其对应的 getter / setter)
问题轨迹如下:
java.lang.IllegalArgumentException: Cannot convert [] of type class java.util.HashSet to class xxx.yyy.zzz.entities.MyObjectBean
at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:397)
at com.sun.el.parser.AstValue.setValue(AstValue.java:194)
at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:286)
at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:88)
at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:124)
at org.richfaces.renderkit.SortingFilteringRowsRenderer.updateAttribute(SortingFilteringRowsRenderer.java:142)
at org.richfaces.renderkit.SelectionRenderer.doDecode(SelectionRenderer.java:175)
at org.richfaces.renderkit.ExtendedDataTableRenderer.doDecode(ExtendedDataTableRenderer.java:805)
at org.richfaces.renderkit.RendererBase.decode(RendererBase.java:80)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:790)
at org.richfaces.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:816)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIForm.processDecodes(UIForm.java:216)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:941)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
有线索吗? 提前致谢
@EDT 的选择必须评估为一个集合,看起来你的指向单个对象。