title: How to get checked checkboxes in JSP
body: <p>How can I get/set checkbox value using jstl and delete only those record from the database where the checkbox is checked? can you also advise how to use ternary operators in jstl for this scenario?</p>
  
  <p>SearchStudent.jsp</p>
  
  <pre><code>    &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
      &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%&gt;
  
      &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;Lookup Students&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;form method="post" action="deleteStudentServlet" class="form"&gt;     
          &lt;body class="body"&gt;
  
          &lt;!-- List results --&gt;
  
          &lt;c:if test="${not empty studentList}"&gt;
              &lt;table border="1" cellspacing="0" cellpadding="0" :&gt;
                  &lt;tr&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;ID&lt;/th&gt;
                      &lt;th&gt;Title&lt;/th&gt;
                      &lt;th&gt;First Name&lt;/th&gt;
                      &lt;th&gt;Last Name&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;c:forEach var="students" items="${studentList}"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;input type="checkbox" name="chkBox"&gt; &lt;/td&gt;
                          &lt;td&gt;${students.studentID}&lt;/td&gt;
                          &lt;td&gt;${students.title}&lt;/td&gt;
                          &lt;td&gt;${students.firstName}&lt;/td&gt;
                          &lt;td&gt;${students.lastName}&lt;/td&gt;
                          &lt;td&gt;&lt;c:url value="UDS" var="url"&gt;
                                  &lt;c:param name="StudentID" value="${students.studentID}" /&gt;
                              &lt;/c:url&gt; &lt;a href="${url}"&gt;Edit&lt;/a&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/c:forEach&gt;
              &lt;/table&gt;
          &lt;/c:if&gt;
  
          &lt;td&gt;&lt;input type="submit" name="submit" value="Delete" &gt;&lt;/td&gt;
      &lt;/form&gt;
  
          &lt;p&gt;There are ${fn:length(studentList)} results.&lt;/p&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>thanks.</p>