When we transmit parameters, we often encounter parameters of the same attributes to the background. The best choice is to use an array method. When we transmit it to the background, we only need to define and use arrays normally in JavaScript to pass it as a parameter to the background:
Copy code code as follows:
var array= new Array();
arr[0] = "102";
arry [1] = "103";
arry [2] = "104";
url = "test.jsp? Arry ="+arry;
Accepting method in the background:
[Code]
String arry = request.getparmeter ("Arry");
String [] Par = Arry.split (",", ");
[Code]
At this time, Par became a array in a Java. Among them, the value of Arry is "102,103,104", which means that during the transmission process, the browser automatically converts the array parameters of the JavaScript type into a strings separated by a comma. Just as the corresponding array.
In addition, I have seen using JSON on the Internet, and it feels not very cool. It also uses the REQUEST.GetParmeterValues method. The specific use is as follows:
Use the same parameter in the front desk and give multiple assignments:
url = "test.jsp? Arry = 102 & arry = 103 & arry = 104"
Take it out in the background:
String arry [] = request.getparmeterValues ("Arry");
The value of Arry at this time is {102,103,104}
Choose according to your habits!