[
https://issues.apache.org/jira/browse/MYFACES-1759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matthias Weßendorf updated MYFACES-1759:
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.2.1-SNAPSHOT
Status: Resolved (was: Patch Available)
Thx to Leonardo Uribe, for his patch
> JSR-252 Issue #69: Permit the passing of a null value to
> SelectItem.setValue(). A SelectItem with null value adds message Value is not
> valid
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: MYFACES-1759
> URL: https://issues.apache.org/jira/browse/MYFACES-1759
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-252
> Environment: tomcat 6, myfaces-1.2.1-SNAPSHOT (05 nov 2007)
> Reporter: Leonardo Uribe
> Fix For: 1.2.1-SNAPSHOT
>
> Attachments: patchNullUISelectOne.patch
>
>
> The following code:
> <h:selectOneListbox id="si" binding="#{selectItemBean.component}"
> value="#{selectItemBean.value}">
> <f:selectItems value="#{selectItemBean.list}"/>
> </h:selectOneListbox>
> If the list is created as is:
> public List<SelectItem> getList()
> {
> List<SelectItem> lista = new ArrayList<SelectItem>();
> lista.add(new SelectItem(null, "NULL 2");
> lista.add(new SelectItem("", "EMPTY"));
> lista.add(new SelectItem("1", "Value 1"));
> lista.add(new SelectItem("2", "Value 2"));
> return lista;
> }
> Render this:
> <select id="form:si" name="form:si" size="4">
> <option value="" selected="selected">NULL 2</option>
> <option value="" selected="selected">EMPTY</option>
> <option value="1">Value 1</option>
> <option value="2">Value 2</option>
> </select>
> null and empty String values are annotated equally.
> The problem is that JSF RI assumes value="" as null when converting the
> value, but myfaces assumes empty String.
> The submited value is an empty String, decoded on JSF RI as null and on
> Myfaces as empty String.
> JSF RI does not show this item as selected but set the value
> correctly to null. Myfaces sends a validation message "Validation Error:
> Value is not valid".
> To be according to the spec, the preferred behavior is that JSF RI shows, so
> it's necessary a correction on myfaces to be compatible.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.