tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Access hidden fields array
Date Wed, 03 May 2017 14:17:34 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tobias,

On 5/3/17 6:48 AM, Tobias Soloschenko wrote:
> The reason why I used the brackets was that in some cases
> (browsers) only the first value was returned. (Even if there were
> more then one hidden field with that name)

This is incorrect. Browsers don't have a high-level API for
manipulating URLs, parameters, etc. If you are using a toolkit, it may
add these restrictions, but the browser has nothing to do with it.

> Also mentioned here: http://stackoverflow.com/a/6547234 - PHP is
> also resolving the variable without brackets.

PHP uses the "[]" suffix to indicate that a parameter name is expected
to have multiple values, and expose those values to the PHP script as
an array (instead of returning e.g. only the first value encountered).

> There are various other questions at stackoverflow mentioning to
> get the variable without brackets:
> 
> http://stackoverflow.com/questions/6547209/passing-array-using-html-fo
rm-hidden-element
>
> 
http://stackoverflow.com/questions/4237090/how-to-pass-array-through-hid
den-field
> http://stackoverflow.com/questions/29076219/javascript-storing-array-o
f-objects-in-hidden-field
>
>  Don't know if this should be supported.

The servlet spec is clear: the name of the parameter is the name of
the parameter from the HTTP request. If you decide to name your
parameter "array[]", then you must access it using "array[]".

If you want to use a framework that adds that kind of interpretation,
you are welcome to do so, but Tomcat will never add anything like that.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJZCeZ+AAoJEBzwKT+lPKRYo3YP+gPNiJbe0zeTrowUnsKxiViI
0dBZqQwm4XLqxVPNobixQQ1Su0uKSfBCesQwrdhVZCBRGKb8DO5UvSxvWUexr84I
GFfNObXiZD9b0pf9JRGNjlrBT4EA8/ehWGCqgVT1cqUfme2GtPp5Km9ODjqzwhKO
XKhXSuBhO1weg948hNd0W1nrYfWd632FoWiLXVbiXERlsD4s5eTakgrkQkaf9NA0
meEbOFqvvNinU73Z2rLql0S3s4dW7UVlUNKqRK+yaWEM73RE8Ij985uXQAuiPOYz
LNdauOkFo9SshpEmAOGGN/TVCowqGKhkEcVL2Jo49oU0lGxyJJGkgtOrQwnWQsHy
3iJhVvV2AWTwN5ICevZ183oNSYDFALisIExuQmMoCg6aKIhHl4l9KccC+DMgpmZp
kAiGqJAIHzJOFcxXuP8gVuefmPJn4pfTA9ZN2yEFbWAwJm8IB6osadjfUTLwAdHz
dTBn1BtkcoB+cC3eiHmOnpigtkbHb7/j9Oeud3tCCuyvyA8ykKzPm4glkTq+heN4
yNvsGdBGthG7IdVHDaOptm8TGoWf9Q6r9k/jpkyl3DYInFm8D1m+UWJpSpaFwL+d
vHaZUAJTw/F1UQaoFCIShPca7ncNjNy/P3EERw07unHdynVtwGzDr3eKqBn73ehA
2cl2EUS9mgegSz/0/U2V
=H+SQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message