Originating From: http://blog.csdn.net/ojackhao/article/details/24580437
At first I thought traditional:true, dispensable, but later did not need to traditional, found that the background can not get the value of selectusers, then it is certain that the traditional default value is False.
When the submitted parameter is an array ({Selectusers:[value,value,value]}), if False, the commit will be "selectusers[]=value&selectusers[]=value"
If set to true, the commit will be "selectusers=value&selectusers=value"
So backstage can use string[] ids=request.getparametervalues ("selectusers"); Gets the value.
The official documentation is explained below:
Traditional
Type: Boolean
If you want to serialize the data in a traditional way, set it to true.
Set this to true if you wish to use the traditional style of Param serialization
One: Front desk jquery
DeleteAll () {
var selectusers=new Array ();
var selectusers = null;
$ (": Checkbox[name= ' UserID ']"). each (function () {
if ($ (this). attr ("checked"))
Selectusers.push ( $ (this). Val ());
//selectusers + = "," + $ (This). Val ();
})
//alert (selectusers);
$.ajax ({
//async:false,
Traditional:true,
Type: "Post",
URL: "elecuseraction_delete.do",
Data : {selectusers:selectusers},
/* Success:function (responstext) {
if (responstext== "1") {
Alert ("Delete succeeded");
}
} */
});
}
Two: Background action code
Public String Delete () {
//actioncontext context=actioncontext.getcontext ();
// HttpServletRequest request= (httpservletrequest) context.get (servletactioncontext.http_request);
String[] Ids=request.getparametervalues ("selectusers"); &NBSP
System.out.println (ids.tostring ());
PrintWriter out = null;
Out.write ("1");
return home ();
}
JQuery $.ajax passed the traditional parameter of the array must be true