Hi Andy,

maybe you forgot to initialize the ArrayList as a new Object in the setter?

try this:

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

Maybe worth a try. Not tested.

Cheers,
Nico


-----Ursprüngliche Nachricht-----
Von: Andy Chapman [mailto:andrew.chap...@brighterworking.com] 
Gesendet: Samstag, 4. September 2010 02:59
An: user@struts.apache.org
Betreff: How do I get wibble[0][something]=blah to parse into an action?

  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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


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

Reply via email to