Although the example I have is simple, the final page is going to have a fairly complex form. I would very much like to submit the data via a json object. I assume this has been done by many since it seems that it would be a frequent request. And is also demonstrated on the json plugin spec page.
On Saturday, June 4, 2011, Maurizio Cucchiara <maurizio.cucchi...@gmail.com> wrote: > This should not be a JSON plugin's error, more likely a OGNL conversion error. > The problem have to do with the ajax request. JQuery send the > following query string: > integerList[]=1&integerList[]=3 > Try to express the data parameter in html instead of json: > data: "ignoreTaskIds=1&ignoreTaskIds=3" > > On 4 June 2011 17:20, Burton Rhodes <burtonrho...@gmail.com> wrote: >> I am trying to do something incredibly simple and for some reason I >> cannot get the JSON plugin to work. Below are a few code snippits. >> Can any tell me why I get an error when trying to set a List<Integer> >> when using the JSON plugin? Do I need a converter for this? Or am I >> missing somthing simple? >> >> // Test Submit - This correctly sets 'xactionId' >> $.ajax({ >> url: "json/TaskBatchJson_saveNewTasks.action", >> data: { 'xactionId': 1 }, >> success: function(data){ >> alert("Success."); >> } >> }); >> >> // Test Submit - This gives me an error (below) >> $.ajax({ >> url: "json/TaskBatchJson_saveNewTasks.action", >> data: { 'ignoreTaskIds': [1,2] }, >> success: function(data){ >> alert("Success."); >> } >> }); >> >> >> ** Error When Trying to Set "ignoreTaskIds" >> WARN : Error setting expression 'ignoreTaskIds[]' with value >> '[Ljava.lang.String;@19e9da7' >> ognl.ExpressionSyntaxException: Malformed OGNL expression: >> ignoreTaskIds[] [ognl.ParseException: Encountered " "]" "] "" at line >> 1, column 15. >> >> >> My Action includes the following: >> >> private int xactionId; >> private List<Integer> ignoreTaskIds; >> >> public int getXactionId() { >> return xactionId; >> } >> public void setXactionId(int xactionId) { >> this.xactionId = xactionId; >> } >> public List<Integer> getIgnoreTaskIds() { >> return ignoreTaskIds; >> } >> public void setIgnoreTaskIds(List<Integer> ignoreTaskIds) { >> this.ignoreTaskIds = ignoreTaskIds; >> } >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > Maurizio Cucchiara > > --------------------------------------------------------------------- > 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