データがあり、表示したい。 telnumbers
と'teltype`は所有者の1つの列になければなりません。表を正しく表示する方法は?
私はこれがあります。
と、この私のコード: '目' の数が一致する必要が適切に表示するための表について
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:spring="http://www.springframework.org/tags"
version="2.0">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<jsp:output omit-xml-declaration="yes"/>
<style>
table, th, td {
border: 1px solid black;
}
</style>
<h1>Contact list</h1>
<c:if test="${not empty contacts}">
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Birth Date</th>
<th>tel_type</th>
<th>tel_number</th>
<th>hobby</th>
</tr>
</thead>
<tbody>
<c:forEach items="${contacts}" var="contact">
<jsp:useBean id="contact" scope="page" type="org.training.support.model.Contact"/>
<tr>
<td>"${contact.firstName}"</td>
<td>"${contact.lastName}"</td>
<td>"${contact.birthDate}"</td>
<c:forEach items="${contact.contactDetails}" var="telDetail">
<jsp:useBean id="telDetail" scope="page" type="org.training.support.model.ContactTelDetail"/>
<td>"${telDetail.telNumber}"</td>
<td>"${telDetail.telType}"</td>
</c:forEach>
<c:forEach items="${contact.hobbies}" var="hobby">
<jsp:useBean id="hobby" scope="page" type="org.training.support.model.Hobby"/>
<td>"${hobby.id}"</td>
</c:forEach>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</div>
各データのためにTDを使用しないでください以下になりますです。 2 td –
を使用する代わりにいくつかの区切り文字を使用してくださいこれはあなたに役立つと思います。 「2列にまたがるセル」を確認します。 https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_span助けてくれないともう一度尋ねてください –
申し訳ありませんが、私はランダムなcolspanを私の例(この良い例ですが、私の場合は動作しません。contact.contactDetails.size()が定義されていません(ランダム)( –