I am able to display a table when a user clicks a search button. But now I want to split the table into chunks of 20 rows where the user can click next or previous to go forward and backward through all of the data. I am not allowed to use JavaScript for this assignment. Only JSP, Java, HTML.
The two debugging out.print() calls are not showing up. A different page is being loaded after one of the buttons is clicked, but the two debugging out.print calls are not displaying any HTML. I have checked out How to know which button is clicked on jsp this post but had no luck.
    <form method="GET">
      <center>
        <input type="submit" name="previous_table" value="Previous" />
        <input type="submit" name="next_table" value="Next" />
      </center>
    </form>
    </br>
    <%
          String val1 = request.getParameter("previous_table");
          String val2 = request.getParameter("next_table");
          try {
            if ("Previous".equals(val1)) { // Get previous results
              out.println("<h1>HELLO 1</h1>");
              buildTable(rs, out, false);
            }
            else if ("Next".equals(val2)) { // Get next results
              out.println("<h1>HELLO 2</h1>");
              buildTable(rs, out, true);
            }
          } catch(Exception e) {
            out.print("<center><h1>"+e.toString()+"</h1></center>");
          }
    %>
I also have a follow up question. If the user clicks next or previous button, will my current table on the page be overwritten by the new one? That is my intent but I don't know if it will work that way.
I WAS ABLE TO FIX IT BY DOING THIS:
    <form method="POST">
      <center>
        <input type="submit" name="previous_table" value="Previous" />
        <input type="submit" name="next_table" value="Next" />
      </center>
    </form>
    </br>
    <%
          String val1 = request.getParameter("previous_table");
          String val2 = request.getParameter("next_table");
 
     
    