You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (Jira)" <ji...@apache.org> on 2022/09/14 19:07:00 UTC

[jira] [Closed] (WW-2612) Support for Lists using s:hidden tag

     [ https://issues.apache.org/jira/browse/WW-2612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart closed WW-2612.
-----------------------------
    Resolution: Not A Problem

> Support for Lists using s:hidden tag
> ------------------------------------
>
>                 Key: WW-2612
>                 URL: https://issues.apache.org/jira/browse/WW-2612
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.0.11.1
>            Reporter: Steve Akins
>            Priority: Minor
>             Fix For: 6.1.0
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)