0

I have an application using struts2-ognl. I have an array of strings and it gets populated by GET parameters in the request. Like the following example

http://localhost:8080/myapp/myAction.action?myArray[1]=value1&myArray[2]=value2 etc etc

Is there any way to instruct ognl that for arrays I don't want to use "[" or "]" but another set of characters ( let;s say for example "(" and ")" so the url could work like:

http://localhost:8080/myapp/myAction.action?myArray(1)=value1&myArray(2)=value2 etc etc

I'm asking this because "[" and "]" are url reserved characters. I have tried to urlEncode them but then ognl ignores those parameters.

Panos
  • 7,227
  • 13
  • 60
  • 95
  • What issues do you have with `[...]`? – Aleksandr M Jul 17 '14 at 12:02
  • 1
    IIRC you don't even need the `[]`, you can just have multiple `myArray=xxx` parameters, too. – Dave Newton Jul 17 '14 at 12:16
  • ...if it isn't some object property. – Aleksandr M Jul 17 '14 at 12:35
  • url reserved?! where did you get that? – Roman C Jul 17 '14 at 14:45
  • @AleksandrM Users reach my server through a secured infrastracture from Cisco that blocks urls that do not follow the standards. I can't reduce the security level, as security is point #1 in the app. – Panos Jul 17 '14 at 16:19
  • @DaveNewton of course I need [] . Without them you can only populate simple objects or arrays.. For arrays in my case you need [] to show the index ( I pass specific index for each parameter ). Also most times I populate Map. – Panos Jul 17 '14 at 16:21
  • @RomanC Check this: http://stackoverflow.com/questions/1856785/characters-allowed-in-a-url – Panos Jul 17 '14 at 16:21
  • @Panos Or lists; S2 will structure multiple params with the same name. It'll actually do them in order, too, but passing a specific index is fine--no need to be snippy about it. – Dave Newton Jul 17 '14 at 16:42
  • @Panos I thought `[]` are well supported in query string. – Roman C Jul 19 '14 at 18:29

0 Answers0