You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mathias Broekelmann (JIRA)" <in...@incubator.apache.org> on 2005/03/22 12:11:24 UTC

[jira] Created: (MYFACES-144) html select components not showing the selected option

html select components not showing the selected option
------------------------------------------------------

         Key: MYFACES-144
         URL: http://issues.apache.org/jira/browse/MYFACES-144
     Project: MyFaces
        Type: Bug
    Versions: Nightly Build    
    Reporter: Mathias Broekelmann


To reproduce the bug a complex object (other than string) must be used as the value for SelectItem. The object is converted by using a Converter to a string value.

The method HtmlRenderUtils.renderSelectOptions(...) tests the complex object with the converted value which is only working if a string is used as a value for the selectitem.

Here is the fix:

Index: HtmlRendererUtils.java
===================================================================
RCS file: /home/cvspublic/incubator-myfaces/src/share/org/apache/myfaces/renderkit/html/HtmlRendererUtils.java,v
retrieving revision 1.29
diff -u -r1.29 HtmlRendererUtils.java
--- HtmlRendererUtils.java	16 Mar 2005 20:34:36 -0000	1.29
+++ HtmlRendererUtils.java	22 Mar 2005 11:04:20 -0000
@@ -447,7 +447,6 @@
                         useSubmittedValue, Arrays.asList(selectItems));
                 writer.endElement(HTML.OPTGROUP_ELEM);
             } else {
-                Object itemValue = selectItem.getValue();
                 String itemStrValue = RendererUtils.getConvertedStringValue(context, component,
                         converter, selectItem);
 
@@ -458,7 +457,7 @@
                 }
 
                 if ((useSubmittedValue && lookupSet.contains(itemStrValue))
-                        || (!useSubmittedValue && lookupSet.contains(itemValue))) {
+                        || (!useSubmittedValue && lookupSet.contains(itemStrValue))) {
                     writer.writeAttribute(HTML.SELECTED_ATTR,
                             HTML.SELECTED_ATTR, null);
                 }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira