Comment obtenir coché des cases à cocher dans la JSP

Comment puis-je obtenir/définir la case de la valeur à l'aide de jstl et supprimer uniquement les enregistrer à partir de la base de données lorsque la case est cochée? pouvez vous aussi vous conseiller sur la façon d'utiliser ternaire opérateurs jstl pour ce scénario?

SearchStudent.jsp

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Lookup Students</title>
    </head>

    <form method="post" action="deleteStudentServlet" class="form">     
        <body class="body">

        <!-- List results -->

        <c:if test="${not empty studentList}">
            <table border="1" cellspacing="0" cellpadding="0" :>
                <tr>
                    <th></th>
                    <th>ID</th>
                    <th>Title</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th></th>
                </tr>
                <c:forEach var="students" items="${studentList}">
                    <tr>
                        <td><input type="checkbox" name="chkBox"> </td>
                        <td>${students.studentID}</td>
                        <td>${students.title}</td>
                        <td>${students.firstName}</td>
                        <td>${students.lastName}</td>
                        <td><c:url value="UDS" var="url">
                                <c:param name="StudentID" value="${students.studentID}" />
                            </c:url> <a href="${url}">Edit</a></td>
                    </tr>
                </c:forEach>
            </table>
        </c:if>

        <td><input type="submit" name="submit" value="Delete" ></td>
    </form>

        <p>There are ${fn:length(studentList)} results.</p>
    </body>
    </html>

grâce.

OriginalL'auteur Muhammad | 2012-09-12