How to change display format of data on icefaces(j

2019-08-25 05:19发布

I have a List<String> in my JSF managed bean that I am trying to get on Facelets page with ICEfaces components. Below is the view:

<ice:panelGrid>
  <ice:panelGrid>
    <ice:outputText value="Properties:" style="text-align:left;font-size:20px;">         </ice:outputText>
    <ice:selectManyListbox id="CriteriaListbox" style="width: 200px; height: 250px; " partialSubmit="true">
         <!--<p:selectItem value="#{beanInfo.Properties}"/>-->
         <p:selectItem itemLabel="#{beanInfo.Properties}" itemValue="#{beanInfo.Properties}"/>
    </ice:selectManyListbox>
</ice:panelGrid>

Now I am getting data, but it is displayed as [test1, test2, test3] in <ice:selectManyListbox>, while I want them to appear as


test1


test2


test3


If I change my view to

 <ice:panelGrid>
      <ice:panelGrid>
        <ice:outputText value="Properties:" style="text-align:left;font-size:20px;">         </ice:outputText>
        <ice:selectManyListbox id="CriteriaListbox" style="width: 200px; height: 250px; " partialSubmit="true">
             <p:selectItem value="#{beanInfo.Properties}"/>
             <!--<p:selectItem itemLabel="#{beanInfo.Properties}" itemValue="#{beanInfo.Properties}"/>-->
        </ice:selectManyListbox>
    </ice:panelGrid>

Then data does not render in the page and I get the following exception:

java.util.ArrayList cannot be cast to javax.faces.model.SelectItem

How is this caused and how can I solve it? Here is the reference question.

Update1

   java.lang.ClassCastException: java.
lang.String cannot be cast to javax.faces.model.SelectItem
        at com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.countSelectOptionsRecursive(MenuRenderer.java:440) [:]
        at com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.renderSelect(MenuRenderer.java:366) [:]
        at com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:108) [:]
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [:2.1.7-SNAPSHOT]
        at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:359) [:]
        at com.icesoft.faces.renderkit.dom_html_basic.GridRenderer.encodeChildren(GridRenderer.java:197) [:]
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [:2.1.7-SNAPSHOT]
        at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:347) [:]
        at com.icesoft.faces.renderkit.dom_html_basic.GridRenderer.encodeChildren(GridRenderer.java:197) [:]
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [:2.1.7-SNAPSHOT]
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [:2.1.7-SNAPSHOT]
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [:2.1.7-SNAPSHOT]
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [:2.1.7-SNAPSHOT]
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [:2.1.7-SNAPSHOT]
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) [:2.1.7-SNAPSHOT]
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [:2.1.7-SNAPSHOT]
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [:2.1.7-SNAPSHOT]
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [:2.1.7-SNAPSHOT]
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [:2.1.7-SNAPSHOT]
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [:2.1.7-SNAPSHOT]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

0条回答
登录 后发表回答