Hi Andy,
This seems to be a problem with S2. ( See:
http://struts-2.464677.n5.nabble.com/Ognl-problem-td1672158.html#a1672158
and http://www.mail-archive.com/[email protected]/msg96386.html ). I
struggled with this for some time but finally went ahead with a
work-around - changed the list<map> to a list of a new container class
which has the map in it (see code below).
private List<RowData>;
class RowData {
private Map<String,Object> cellData;
}
- Rahul
From:
Andy Chapman <[email protected]>
To:
[email protected]
Date:
04-09-2010 06:29
Subject:
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: [email protected]
For additional commands, e-mail: [email protected]
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you