0
에 html 테이블에 같은 태그를 재사용하는 방법 JSP 페이지 안에 html 테이블이 있습니다. 내 코드는 다음과 같습니다 JSP 페이지
<c:choose>
<c:when test="${empty institutionAttributes}">
<h2 align="center"><spring:message code="label.attributes.msg"/> </h2>
</c:when>
<c:otherwise>
<h3 align="center"><spring:message code="label.result.msg"/> </h3>
<table border="1" align="center">
<thead>
<tr>
<th align="center"><spring:message code="label.header.table.name" /></th>
<th align="center"><spring:message code="label.header.table.type" /></th>
<th align="center"><spring:message code="label.header.table.date" /></th>
<th align="center"><spring:message code="label.header.table.dayscheduale" /></th>
<th align="center"><spring:message code="label.header.table.workscheduale" /></th>
<th align="center"><spring:message code="label.header.table.rotation" /></th>
<th align="center"><spring:message code="label.header.table.numberkids" /></th>
<th align="center"><spring:message code="label.header.table.under3" /></th>
<th align="center"><spring:message code="label.header.table.upper3" /></th>
<th align="center"><spring:message code="label.header.table.goschool" /> <br> <fmt:formatDate value="${formDescriptionVar.kidsGoSchoolDate}" pattern="yyyy"/> <spring:message code="label.header.table.year" /></th>
</tr>
</thead>
<tbody>
<c:forEach items="${institutionAttributes}" var="institutionVar">
<tr>
<td align="center">${institutionVar.nameOfInstitution}</td>
</tr>
</c:forEach>
<c:forEach items="${institutionTypeAttributes}" var="institutionTypeVar">
<tr>
<td align="center">${institutionTypeVar.typeOfInstitution}</td>
</tr>
</c:forEach>
<c:forEach items="${formDateAttributes}" var="formDateVar">
<tr>
<td align="center"><fmt:formatDate value="${formDateVar.particularDate}" pattern="dd-MM-yyyy"/> </td>
</tr>
</c:forEach>
<c:forEach items="${formDescriptionAttributes}" var="formDescriptionVar">
<tr>
<td align="center">${formDescriptionVar.daySchedule}</td>
<td align="center">${formDescriptionVar.workScheduale}</td>
<td align="center">${formDescriptionVar.rotation}</td>
<td align="center">${formDescriptionVar.numberOfKids}</td>
<td align="center">${formDescriptionVar.kidsUnder3YearsOld}</td>
<td align="center">${formDescriptionVar.kidsUpper3YearsOld}</td>
<td align="center">${formDescriptionVar.kidsGoSchoolNumber}</td>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</c:otherwise>
</c:choose>
JSP 페이지의 내부 내가
<thead>
와
<tbody>
태그 테이블이 있습니다.
<tbody>
안에는 JSP의 <c:forEach>
태그가 사용됩니다.
<c:forEach>
내부에는 <tr>
과 <td>
태그가 사용됩니다. 사진에서
내가 원하는 :
|------------------------------------|
| Header1 | Header2 | Header3 |
|------------------------------------|
| Value1 | Value2 | Value3 |
|------------------------------------|
내가 무엇을 얻을 :
|------------------------------------|
| Header1 | Header2 | Header3 |
|------------------------------------|
| Value1 | | |
|------------------------------------|
| | Value2 | |
|------------------------------------|
| | | Value3 |
|------------------------------------|
그래서, 문제가 <c:forEach>
모든 <c:forEach>
안에 새로운 <tr>
를 작성,하지만 내가 필요하면 를 사용하는 것입니다 동일<tr>
다른 <c:forEach>
. 어떻게해야합니까?
예, 나는 내 질문은 충분히 명확하지 않았다 미안 해요 .. 내가 편집 –
@ user2547487, 나는 아직도 당신이해야 할 일이 내가 설명했던 것 같아요 ... 당신이 그것을 시도 했습니까? – MikO
Sir. 그것은 각 행에 nameofInstitution 1, 2, 3을 놓을 것이고, 새로운 행을 형성하게 될 것입니다. 나는 이것이 그렇게되기를 원하지 않는다. 나는 nameofInstitution1과 nameofInstitution2 및 nameofInstitution3을 한 행에 넣어야합니다. 위 사진에서와 같이 ... –