ICEfaces
  1. ICEfaces
  2. ICE-6474

CLONE -Can't send in an array of objects as the values for a selectOneMenu component

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      jsf2.0, ICEfaces-2.0
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.)
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      Use a list/array that consists of SelectItem objects.

      For Example:
              cityList = new ArrayList<SelectItem>();
              cityList.add(new SelectItem("TORONTO", "TORONTO"));
              cityList.add(new SelectItem("CALGARY", "CALGARY"));
      Show
      Use a list/array that consists of SelectItem objects. For Example:         cityList = new ArrayList<SelectItem>();         cityList.add(new SelectItem("TORONTO", "TORONTO"));         cityList.add(new SelectItem("CALGARY", "CALGARY"));

      Description

      With the JSF <h:selectOneMenu> component, you can use an array of objects for the selectOneMenu options. Using the same set of objects for an <ice:selectOneMenu> does not show the options. For example:

      JSF Component Code:
      <h:selectOneMenu value="#{backingBean.city}" >
           <f:selectItems value="#{backingBean.cities}"/>
      </h:selectOneMenu>

      Backing Bean Code:
      public City[] getCities() {
              return City.values();
      }

      Testing with ICEfaces 1.8.x and JSF 1.2 showed that the array of objects does not work for both the JSF and ICEfaces components. It looks like something was changed on the JSF component and this has not been changed with the ICEfaces components.

        Issue Links

          Activity

          Hide
          Wilson Bogado added a comment -

          The following example still does not work:

          <ice:selectOneMenu value="#

          {testBean.itemCode}

          ">
          <f:selectItems value="#

          {testBean.itemList}

          " var="item" itemValue="#

          {item.code}

          " itemLabel="#

          {item.name}

          "/>
          </ice:selectOneMenu>

          Where:
          itemCode is an Integer
          itemList is a List<Item>
          item.code is an Integer
          item.nam is a String

          When running this example, ICEFaces seems to try to assign item.toString() to itemCode which results in a conversion error.
          h:selectOneMenu works as expected.

          Show
          Wilson Bogado added a comment - The following example still does not work: <ice:selectOneMenu value="# {testBean.itemCode} "> <f:selectItems value="# {testBean.itemList} " var="item" itemValue="# {item.code} " itemLabel="# {item.name} "/> </ice:selectOneMenu> Where: itemCode is an Integer itemList is a List<Item> item.code is an Integer item.nam is a String When running this example, ICEFaces seems to try to assign item.toString() to itemCode which results in a conversion error. h:selectOneMenu works as expected.
          Hide
          Wilson Bogado added a comment -

          Issue ICE-6107 does not seem to be resolved.

          Show
          Wilson Bogado added a comment - Issue ICE-6107 does not seem to be resolved.
          Hide
          Adnan Durrani added a comment -

          I have tested ICE-6107 with enum and its working fine.

          <ice:selectOneMenu partialSubmit="true" value="#

          {selectionTags.city}">
          <f:selectItems
          value="#{selectionTags.cities}"/>
          </ice:selectOneMenu>

          <h:outputText value="Selected City : #{selectionTags.city}

          " />

          --------------

          • Bean
            private City city;

          public City getCity()

          { return city; }

          public void setCity(City city)

          { this.city = city; }

          public City[] getCities()

          { return City.values(); }

          public enum City

          { TORONTO, CALGARY; }
          Show
          Adnan Durrani added a comment - I have tested ICE-6107 with enum and its working fine. <ice:selectOneMenu partialSubmit="true" value="# {selectionTags.city}"> <f:selectItems value="#{selectionTags.cities}"/> </ice:selectOneMenu> <h:outputText value="Selected City : #{selectionTags.city} " /> -------------- Bean private City city; public City getCity() { return city; } public void setCity(City city) { this.city = city; } public City[] getCities() { return City.values(); } public enum City { TORONTO, CALGARY; }
          Hide
          Adnan Durrani added a comment -

          Can you please attach a working .war including source code?

          Show
          Adnan Durrani added a comment - Can you please attach a working .war including source code?
          Hide
          Wilson Bogado added a comment -

          I just realized that the ICEfaces selectOneMenu behaves differently when the items are in a List than when they are in an array. In the attached example I try to demonstrate what I have found out. I hope this helps you figure out the problem.

          Show
          Wilson Bogado added a comment - I just realized that the ICEfaces selectOneMenu behaves differently when the items are in a List than when they are in an array. In the attached example I try to demonstrate what I have found out. I hope this helps you figure out the problem.
          Hide
          Adnan Durrani added a comment -

          Thanks Wilson. This test app helped a lot. I am close to fix this bug.

          Show
          Adnan Durrani added a comment - Thanks Wilson. This test app helped a lot. I am close to fix this bug.
          Hide
          Adnan Durrani added a comment -

          Fixed.

          Command: Commit
          Modified: D:\work\development\head\svn\ossrepo\icefaces2\trunk\icefaces\compat\core\src\main\java\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces2\trunk\icefaces\compat\core\src\main\java\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java
          Completed: At revision: 23852

          Show
          Adnan Durrani added a comment - Fixed. Command: Commit Modified: D:\work\development\head\svn\ossrepo\icefaces2\trunk\icefaces\compat\core\src\main\java\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java Sending content: D:\work\development\head\svn\ossrepo\icefaces2\trunk\icefaces\compat\core\src\main\java\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java Completed: At revision: 23852
          Hide
          Mircea Toma added a comment -

          The fix for this issue has created the regression recorded in ICE-6514. The explanation for the fix is found here: http://jira.icefaces.org/browse/ICE-6514?focusedCommentId=32808&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_32808

          Show
          Mircea Toma added a comment - The fix for this issue has created the regression recorded in ICE-6514. The explanation for the fix is found here: http://jira.icefaces.org/browse/ICE-6514?focusedCommentId=32808&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_32808

            People

            • Assignee:
              Adnan Durrani
              Reporter:
              Wilson Bogado
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: