At first I think Traditional:true, dispensable, but later do not need to traditional, found that the background can not get the selectusers value, 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 is "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 as follows:
Traditional
Type: Boolean
If you want to serialize data in a traditional way, set it to true.
Set this to true if your 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");
System.out.println (Ids.tostring ());
PrintWriter out = null;
Out.write ("1");
return home ();
}