Currently, the checkbox does not have a value associated with the parameter name:
<input type="checkbox" name="chkBox">
So hard to find proven. You must specify a value in the checkbox that uniquely identifies the selected item. In your specific example, the student ID seems like an obvious choice:
<input type="checkbox" name="selected" value="${student.studentID}">
(by the way, why are you duplicating the name of the object in the property name? why not just name it so that you can only use the self-documented use of ${student.id} ? Also your var="students" is odd, it only refers to one , so just name it var="student" , ${studentList} better to call ${students} )
When the form is submitted, the entire verified value is available as follows:
String[] selectedStudentIds = request.getParameterValues("selected");
Finally, just pass it to your DAO / service class, which performs the business task:
studentService.delete(selectedStudentIds);
See also:
source share