struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <greg.lindh...@gmail.com>
Subject URL Array parameter encoding arr[]=1&arr[]=2&arr[]=3
Date Thu, 21 May 2015 20:37:20 GMT
Using S2 2.3.16.3

My action wants to take an array of parameters, if they are passed like
arr=1&arr=2&arr=3 then everything works fine.

But by default JQuery encodes arrays as URL parameters like
arr[]=1&arr[]=2&arr[]=3,
the parameters get named "arr[]" instead of "arr".

My action has a setter like:

public void setArr(String[] arr)

This isn't matching the parameter "arr[]" so the setter never gets called.

Is there a way to have Struts recognize that parameters "arr[]" is the same
as array "arr"?

If not, how do I construct a setting that will accept parameters named
"arr[]"?


Greg

P.S. I know how to force jQuery to encode the "traditional" way but would
be nice it just worked.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message