You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christoph Nenning <Ch...@lex-com.net> on 2013/09/12 12:01:16 UTC

question regarding dynamic number of form fields

Dear List,


we have some forms in our applications which contain a dynamic number of 
fields.

Therefore we have a map as action member and generate HTTP parameter names 
like this:

<input name="map['key']" ...


But that does not work when the key contains spaces:

<input name="map['key with spaces']" ...



I created a small sample application to illustrate that:
https://github.com/wolpi/struts2-samples/tree/master/mapparaspaces


Could you please have a look at this?


Regards,
Christoph

This Email was scanned by Sophos Anti Virus

Re: question regarding dynamic number of form fields

Posted by Lukasz Lenart <lu...@apache.org>.
It's because of restrictions in ParametersInterceptor - it doesn't
allow keys with spaces as this can be potential malicious code. Check
docs [1] and source [2]

[1] http://struts.apache.org/development/2.x/docs/parameters-interceptor.html
[2] https://svn.apache.org/repos/asf/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2013/9/12 Christoph Nenning <Ch...@lex-com.net>:
> Dear List,
>
>
> we have some forms in our applications which contain a dynamic number of
> fields.
>
> Therefore we have a map as action member and generate HTTP parameter names
> like this:
>
> <input name="map['key']" ...
>
>
> But that does not work when the key contains spaces:
>
> <input name="map['key with spaces']" ...
>
>
>
> I created a small sample application to illustrate that:
> https://github.com/wolpi/struts2-samples/tree/master/mapparaspaces
>
>
> Could you please have a look at this?
>
>
> Regards,
> Christoph
>
> This Email was scanned by Sophos Anti Virus

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org