我有一个这样的jsp页面:
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Page for find kids</title>
</head>
<body>
<a href="#" id="shlink"><h3 align="center">Parameters of search</h3></a>
<form:form action="result" method="get" modelAttribute="fbosAttribute" >
<table id="searchForm" align="center">
<tr id="dateId">
<th>Date:</th>
<td><form:select path="particularDate">
<form:option value=""> -Выберите дату-</form:option>
<form:options items="${listOfDates}"></form:options>
</form:select> <td><font color="#FF0000"><b><form:errors path="particularDate"/></b> </font></td>
</td>
</tr>
<tr id="nameId">
<th>Name:</th>
<td><form:select path="nameOfInstitution">
<form:option value=""> -Выберите учреждение-</form:option>
<form:options items="${listOfInstitutionsNames}"></form:options>
</form:select></td> <td><font color="#FF0000"><b><form:errors path="nameOfInstitution"/></b></font></td>
</tr>
<tr id="typeId">
<th>Type:</th>
<td>
<form:select path="typeOfInstitution">
<form:option value=""> -Выберите тип-</form:option>
<form:options items="${listOfInstitutionsTypes}"></form:options>
</form:select> </td> <td><font color="#FF0000"><b><form:errors path="typeOfInstitution"/></b></font></td>
</tr>
<tr>
<td>
<input type="submit" value="Find" id="searchBtn" />
</td>
</tr>
</table>
</form:form>
<c:choose>
<c:when test="${empty dateAttribute}">
<h1 align="center">Insert parameterst for search</h1>
</c:when>
<c:otherwise>
<table align="center" border="1" id="resultTable">
<thead>
<tr>
<th>Name of school</th>
<th>Type</th>
<th>Particular date</th>
<th>Day Scheduale</th>
<th>Work Scheduale</th>
<th>Rotation</th>
<th>Number of kids</th>
<th>Kids upper 3 years old</th>
<th>Kids under 3 years old</th>
<th>Kids go to school date </th>
<th>Kids admitted date</th>
</tr>
</thead>
<c:forEach items="${institutionAttribute}" var="institutionVar">
<c:forEach items="${dateAttribute}" var="creationDateVar">
<c:forEach items="${srcAttribute}" var="schRotChildVar">
<tr>
<td align="center">${institutionVar.nameOfInstitution}</td>
<td align="center">${institutionVar.typeName}</td>
<td align="center">${creationDateVar.particularDate} </td>
<td align="center">${schRotChildVar.dayScheduale}</td>
<td align="center">${schRotChildVar.workScheduale}</td>
<td align="center">${schRotChildVar.rotation}</td>
<td align="center">${schRotChildVar.numberOfChild}</td>
<td align="center">${schRotChildVar.childUnder3YearsOld}</td>
<td align="center">${schRotChildVar.childUpper3YearsOld}</td>
<td align="center"><fmt:formatDate value="${creationDateVar.childGoSchoolDate}" pattern="dd-MM-yyyy" /> </td>
<td align="center"><fmt:formatDate value="${creationDateVar.childAdmissionDate}" pattern="dd-MM-yyyy" /></td>
</tr>
</c:forEach>
</c:forEach>
</c:forEach>
</table>
</c:otherwise>
</c:choose>
</body>
</html>
因此,当我不是从这个 jsp 中提取数据,而是从我的 main() 方法中提取数据时,它工作得非常好。什么意味着我的实现 - dao 类工作稳定。但是当我使用这个 jsp 时,它会提取 10 次以上的相似数据。我想这个标签<c:forEach>
,这里一定是出现了问题。请帮我解决它。你的建议,也许我不需要<c:forEach>
标签,可能有不同的东西。