struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Chapman <andrew.chap...@brighterworking.com>
Subject How do I get wibble[0][something]=blah to parse into an action?
Date Sat, 04 Sep 2010 00:58:49 GMT
  I've got a 3rd party javascript tool that posts parameters like:

wibble[0][something] = /babble
wibble[0][foo] = 3
wibble[0][bar] = seventeen
wibble[1][something] = /bloop
wibble[1][foo] = 12
wibble[1][bar] = Only on Wednesdays

I can't figure out how to get the ParametersInterceptor to put the 
values it into my setter.
I've tried all sorts of things, but the [something] is failing to get 
through. My best effort was something like this,

public MyActionClass extends ActionSupport {

     ArrayList<Map<String, String>> wibble = null;

<...execute etc. don't really matter...>

     public ArrayList<Map<String, String>> getWibble() {
         if (this.wibble==null) {
             this.wibble = new ArrayList<Map<String, String>>();
         }
         return this.wibble;
     }

     public void setWibble(ArrayList<Map<String, String>> wibble) {
         this.wibble = wibble;
     }
}

In debug I can see the struts2 innards calling getWibble for each post 
parameter and creating the 0'th or 1'th element of the ArrayList but 
then it seems to resolve [something] by looking for a property or method 
(setSomething?) on the MyActionClass instance in the context rather than 
the ArrayList instance it got previously (which never goes into the 
context).

Obviously, I can make the action RequestAware and parse out the 
parameters myself or write/extend an interceptor, but it would be nice 
to have the base ParameterInterceptor and OGNL do it .

Any ideas?

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


Mime
View raw message