Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:11:03+00:00 2026-05-31T15:11:03+00:00

I am having HTML table on my page and am trying to populate it

  • 0

I am having HTML table on my page and am trying to populate it with some data from my managed bean, my xhtml page looks like:

       <ice:panelGrid columns="2">
            <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}"/>
                </ice:selectManyListbox>
            </ice:panelGrid>
      </ice:panelGrid>

My managed bean looks like:

public ArrayList<String> getProperties()
{
    return properties;
}

and in constructor am populating properties as shown:

public BeanInfo(){
   createProperties();
}

createProperties(){
    ArrayList<String> properties = new ArrayList<String>();
    properties.add("roi");
    properties.add("val");
}

Am new to jsf and icefaces and so not sure what is the issue in here. Any suggestions?

Update

So there is nothing in my table but am getting java.util.ArrayList cannot be cast to javaax.faces.model.SelectItem exception.

Update 2

This is the exception am getting after Nikita’s Approach and updating my JSF version from Mojarra-2.0.3 to Mojarra-2.1.7, any suggestions.

Error Rendering View[/admin/Template.xhtml]: 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]

Update 3: Current xhtml

  <ice:panelGrid columns="2">
            <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:selectItems value="#{bookBeanInfo.properties}"
                                  var="property"
                                  itemValue="#{property}"
                                  itemLabel="#{property}"/>

                </ice:selectManyListbox>

            </ice:panelGrid>

            <ice:panelGrid>
                <ice:outputText value="Name:" style="text-align:left;font-size:20px;" id="bookName"></ice:outputText>
            </ice:panelGrid>
            <ice:panelGrid>
                <ice:inputText id="NameInputText" style="width: 195px;" value="#{bookBeanInfo.bookName}"></ice:inputText>
            </ice:panelGrid>

Update 4: Namespace declaration

html xmlns="http://www.w3.org/1999/xhtml"
xmlns:icecore="http://www.icefaces.org/icefaces/core"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:p="http://java.sun.com/jsf/core"
xmlns:ice-cc="http://www.icesoft.com/icefaces-composite-comps">

Update5

I was able to fix the exception by using array list of SelectItem types rather then String so in my bean, I have:

createProperties(){
    ArrayList<SelectItem> properties = new ArrayList<SelectItem>();
    properties.add(new SelectItem("roi", "roi"));
    properties.add(new SelectItem("val"."val"));
}

and in my xhtml page, i have to use selectItems instead of selectItem as on my xhtml page am expecting collection and so need to use selectItems to iterate through them:

 <ice:panelGrid columns="2">
        <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:selectItems value="#{beanInfo.properties}"/>
            </ice:selectManyListbox>
        </ice:panelGrid>
  </ice:panelGrid>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:11:04+00:00Added an answer on May 31, 2026 at 3:11 pm

    It is causing ClasscastException because in constructor of bean you are making a collection of type String i.e. Arraylist<String> while JSF uses collection of type SelectItem i.e. Arraylist<SelectItems>. When with current setting page renders it thows ClasscastException, which s obvious.

    Posible Fix:
    (1) change the type of collection in constructor. Make it
    Arraylist<SelectItem>
    (2) <f:selectItem> (as suggested by others) should work. But if it doesn’t then try below:

     <ice:selectOneMenu value="myProperties">  
       <ice:selectItems value="#{beanInfo.properties}" />
     </ice:selectOneMenu>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to export some data from a SQL Express table to Access
I am reading a table row from one page, and then trying to put
Trying out some things with php and html, I'm having issues trying to get
I am having a HTML table with many rows. I have seven columns in
Given the following html table and script shown below I am having a problem
How can I use Nokogiri with having html entities (like German umlauts) untouched? I.e.:
i am having a HTML like <p style= class=fieldChoices title>Choices: <input value=option1 maxlength=150 id=Choice1/>
I'm having a problem while trying to dynamically change a table cell's styling class
I'm trying to scrape the data off a web page using the python Windmill
I am having issues with an html table that is overflowing it's parent container.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.