getting value of selected checkbox from datatable in jsp

i’m using java ee,
here my jsp:

<form  method="POST" enctype="multipart/form-data"action="<c:url value="submitSelected"/>">
<div class="box-body">
    <table id="example" class="table table-bordered table-striped">
                <th><input type="checkbox" id="checkall" /></th>
            <c:forEach var="category" items="${categoryList}">
                    <td><c:out value="${}"/></td>
                    <td><c:out value="${}"/></td>
                    <td><input type="checkbox" name="selectedCategory" value="${}" /></td>
    <div class="box-footer" id="hidden-div">
        <button type="submit" id="select" >submit</button>

here my js :

<script type="text/javascript">
$(document).ready(function () {
        "scrollX": true
    $("#example #checkall").click(function () {
        if ($("#example #checkall").is(':checked')) {
            $("#example input[type=checkbox]").each(function () {
                $(this).prop("checked", true);

        } else {
            $("#example input[type=checkbox]").each(function () {
                $(this).prop("checked", false);

i get my checkbox values in my servlet using:

String checkboxValues[] = request.getParameterValues("selectedCategory");

im using datatable in my jsp, my question is if my jsp display more than 1 page and i select some rows from those page, my servlet only get values only from displayed page. how to get all the selected value from servlet? and if i use the checkall checkbox, how to get all value from servlet?
thanks and sorry for my bad english

Source: jsp

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.