我有这个(非常凌乱)bookings.jsp文件,显示不同的预订及其属性。我的问题是,无论如何我可以修改.jsp文件,以便根据属性的值更改颜色/删除线。例如,每个Booking对象都有一个布尔“已删除”。有没有办法将所有具有“deleted”= true的Booking对象设置为删除线?
这是我的bookings.jsp文件:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html>
<html lang="en">
<jsp:include page="../fragments/head.jsp"/>
<body>
<jsp:include page="../fragments/menu.jsp"/>
<div id="body">
<section class="content-wrapper main-content clear-fix">
<h2>List of bookings</h2>
<p>
<a href="/restaurant/create">Add restaurant</a>
<a href="/booking/create">Create New Booking</a>
</p>
<table class="">
<tr>
<th>
Booking information
</th>
<th></th>
</tr>
<c:forEach items="${restaurants}" var="restaurants">
<tr>
<td><h3>${restaurants}</h3></td>
<td valign="bottom"><a href="/restaurant/edit/${restaurants.id}">Edit restaurant</a></td>
<tr>
<table class="myTable">
<col align="left" width="110">
<col align="left" width="60">
<col align="left" width="60">
<col align="left" width="60">
<col align="left" width="60">
<col align="left" width="90">
<col align="left" width="90">
<col align="left" width="90">
<col align="left" width="110">
<col align="left" width="100">
<tr>
<td align="left"><b>Date</b></td>
<td align="left"><b>Start</b></td>
<td align="left"><b>Duration</b></td>
<td align="left"><b># Of People</b></td>
<td align="left"><b>Name</b></td>
<td align="left"><b>Contact Pref.</b></td>
<td align="left"><b>Phone #</b></td>
<td align="left"><b>Comments</b></td>
<td align="left"><b>Booking date</b></td>
<td align="left"><b>Edited</b></td>
</tr>
<c:forEach items="${sortedBooking}" var="sortedBooking">
<c:choose>
<c:when test="${restaurants == sortedBooking.restaurant.restaurantName}">
<tr>
<td>${sortedBooking.date}</td>
<td>${sortedBooking.start}</td>
<td>${sortedBooking.duration}</td>
<td>${sortedBooking.amountOfPeople}</td>
<td>${sortedBooking.name}</td>
<td>${sortedBooking.contactPreference}</td>
<c:choose>
<c:when test="${sortedBooking.phoneNumber.equals('')}">
<td>NO PHONE</td>
</c:when>
<c:otherwise>
<td>${sortedBooking.phoneNumber}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${sortedBooking.comments.equals('')}">
<td>NO COMMENTS</td>
</c:when>
<c:otherwise>
<td>${sortedBooking.comments}</td>
</c:otherwise>
</c:choose>
<td>${sortedBooking.currentDatetime}</td>
<c:choose>
<c:when test="${sortedBooking.currentDatetime.equals(sortedBooking.newDate)}">
<td align="middle">-</td>
</c:when>
<c:otherwise>
<td>${sortedBooking.newDate}</td>
</c:otherwise>
</c:choose>
<td><a href="/booking/edit/${sortedBooking.id}">Edit booking</a></td>
</tr>
</c:when>
</c:choose>
</c:forEach>
</table>
</tr>
</tr>
</c:forEach>
</table>
</section>
</div>
<jsp:include page="../fragments/footer.jsp"/>
</body>
</html>
感谢任何帮助!