You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Aymeric Levaux (JIRA)" <ji...@apache.org> on 2007/10/17 14:30:40 UTC

[jira] Commented: (WW-2045) Can no longer select null in radiomap

    [ https://issues.apache.org/struts/browse/WW-2045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42407 ] 

Aymeric Levaux commented on WW-2045:
------------------------------------

Ok this fixes the rendering of the radio map. 
But I still get a conversion error on form submit when the selected value is "" (to get a null) .
This is due to the method convertFromString in com.opensymphony.xwork2.util.EnumTypeConverter that does not check for empty string before calling Enum.valueOf. 

Simply adding 

if(value == null || "".equals(value)){
  return null;
}

makes it for me. I didn't checked this thoroughly so it might requires more investigations.

> Can no longer select null in radiomap
> -------------------------------------
>
>                 Key: WW-2045
>                 URL: https://issues.apache.org/struts/browse/WW-2045
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.8
>         Environment: freemarker
>            Reporter: Jasper Rosenberg
>            Assignee: Don Brown
>             Fix For: 2.0.10
>
>
> In my action, have setter getter for myMap property:
> private Map<String, String> myMap = new HashMap<String, String>();
> <@s.radio name="myMap['name']" list='#@java.util.HashMap@{"Opt.":"Opt.", "Std.":"Std.", "":"N/A"}' theme="simple"/>
> In struts 2.0.6, if "name" had no value in the map, then "N/A" would be selected.
> In struts 2.0.8, if "name" has no value in the map, then no option is selected.
> I have tried variations on the list such as '#@java.util.HashMap@{"Opt.":"Opt.", "Std.":"Std.", null:"N/A"}' to work around this issue without luck.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.