The integer array of the foreground is prefixed with a certain symbol (",") and then passed as a string, so that the background is received and then split, and then converted to the desired type. As follows:
1. Rewrite the foreground code, convert the array to a string using the Join () method of array, and split with ","
$ ("#confirm"). button (). Click (function () {
var selecteduseids = new Array ();
$ (' input[name=bidder_winner]:checked '). each (function () {
Selecteduseids.push ($ (this). Val ());
});
if (selecteduseids.length==0) {
Alert ("Please select the winning bidder!") ");
}
else{
$.ajax ({
Type: "POST",
URL: "Confirmbidder.action",
Data: "taskid=" + target_this + "&bidderwinneruserids=" + selecteduseids.join (","),
Success:function (msg) {
Alert ("Successful bidding process");
}
});
}
});
After you receive the string Bidderwinneruserids in the background, split it with split.
String[] s = Bidderwinneruserids.split (",");
for (int i=0;i<s.length;i++) {
Long L = Long.parselong (s[i]);
....
}
A method for sending an array from the foreground to the back of a struts