You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jeromy Evans (JIRA)" <ji...@apache.org> on 2008/04/24 04:28:05 UTC
[jira] Commented: (WW-2612) Support for Lists using s:hidden tag
[ https://issues.apache.org/struts/browse/WW-2612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43737#action_43737 ]
Jeromy Evans commented on WW-2612:
----------------------------------
I agree it's confusing for Struts users that if you get an array or list contains:
["22030", "6496", "6457", "6448"] (4 elements)
as a string you receive:
"[22030, 6496, 6457, 6448]"
but if you set that sting value on the same array or list your receive
["[22030, 6496, 6457, 6448]" ] (one element)
I understand the issue is that OGNL syntax for a list is:
"{'22030', '6496', '6457', '6448'}"
and for a native array:
"new String[] {'22030', '6496', '6457', '6448'}"
The default converter should either support OGNL's list syntax {values} or convert [ values] to an array/list when the target property is such.
> Support for Lists using s:hidden tag
> ------------------------------------
>
> Key: WW-2612
> URL: https://issues.apache.org/struts/browse/WW-2612
> Project: Struts 2
> Issue Type: Improvement
> Affects Versions: 2.0.11.1
> Reporter: Steve Akins
> Priority: Minor
>
> If you have a List in an Action that you want to maintain through a form I would expect that coding a s:hidden tag for the List would work.
> Currently the s:hidden tag does represent the List in the generated HTML however when the form is submitted the parameter is not translated back into the List correctly.
> eg.
> If you have a List called "ids" which contains 4 Strings "22030", "6496",
> "6457", "6448" and
> When the following tag is used:
> <s:hidden name="resend.ids" />
> It produces the following HTML:
> <input type="hidden" name="resend.ids" value="[22030, 6496, 6457, 6448]" id="/test/resend_resend_ids"/>
> When the form is submitted the "ids" List is populated with one String
> "[22030, 6496, 6457, 6448]" instead of 4 Strings "22030", "6496", "6457", "6448".
> This looks like XWorkBasicConverter needs some enhancing but I haven't figured out how.
> The only workarounds for this that I can see are:
> 1. Iterate through the List in the JSP and use a s:hidden for each element in the List. This will generate a lot of unnecessary HTML.
> 2. Create a custom converter but I think that support for Lists should be out of the box.
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.