比如后台代码是这样的:
- Java code
public class ImageAction { private ArrayList<HashMap<String,String>> pks; public String update() { for (Map map: pks){ doSth(map.get("seqNo")); ....... } } public ArrayList<HashMap<String, String>> getPks() { return pks; } public void setPks(ArrayList<HashMap<String, String>> pks) { this.pks = pks; } }
ajax:jquery
- JScript code
j$.ajax({ url:approveUrl, data: {pks: {"seqNo":"111"}}, dataType:'json', type:'post', traditional: true, success:function (response) { hideProgressBar(parent.document) if (response.result==false){ alert(response.msg); return; }// document.location.reload(); } })
结果到了后台,发现得到的参数总是ognl.NoConversionPossible,有没有人遇到过,我用的是webwork+jquery 1.4.3
------解决方案--------------------
你既然ajax里的dataType是'json',那action里就拿json接收嘛