SoFunction
Updated on 2025-02-28

JS gets the value of the check box and passes it to the background implementation method

Name the checkbox: <input type='checkbox' name='checkTheme' value='">

When I submit it, I click="aa();"

function aa() {
var bb = "";
var temp = "";
var a = ("checkTheme");
for ( var i = 0; i < ; i++) {
if (a[i].checked) {
temp = a[i].value;
bb = bb + "," +temp;
}
}
("tempString").value = bb
.substring(1, );
}

Put an input hidden property in the jsp page to receive the value in aa():

<input type="hidden"  name="tempString" />

In action:

private String tempString;//get, set methods

String temp1[] = (",");// Intercept the string and get the values ​​of each checkBox

The value in this array temp1[] is the value obtained in each check box to be obtained

The above JS article gets the value of the checkbox and passes it to the background is all the content I share with you. I hope you can give you a reference and I hope you support me more.