<table class="table">
<thead>/span>
<tr>/span>
<th scope="col"/span>> 圖書標識</th>
<th scope="col"/span>> 書名</th>。
<th scope="col"/span>> 書籍作者</th>/span>
</tr>/span>
</thead>/span>
<tbody>/span>
<tr>/span>
<td><c。 forEach items="${searchedBook}" var="book">/span>
${book.book_id}
</c:forEach></td>
</tr>/span>
<tr>/span>
<td><c。 forEach items="${searchedBook}" var="book">/span>
${book.book_name}
</c:forEach></td>
</tr>/span>
<tr>/span>
<td><c。 forEach items="${searchedBook}" var="book">/span>
${book.book_author}
</c:forEach></td>
</tr>/span>
</tbody>/span>
</table>
但是我想要的方式是這樣的。 我想要的樣子
有什么辦法可以做到這一點嗎?
uj5u.com熱心網友回復:
你在<td>標簽內宣告forEach回圈,它在單個<td>中列印所有資料。
下面是修改后的代碼:
<table class="table">
<thead>/span>
<tr>/span>
<th scope="col"/span>> 圖書標識</th>
<th scope="col"/span>> 書名</th>。
<th scope="col"/span>> 書籍作者</th>/span>
</tr>/span>
</thead>/span>
<tbody>/span>
<tr>/span>
<c: forEach items="${searchedBook}" var="book">
<td>${book.book_id}</td>
</c:forEach>/span>
</tr>
<tr>/span>
<c: forEach items="${searchedBook}" var="book">
<td>${book.book_name}</td>
</c:forEach>/span>
</tr>
<tr>/span>
<c: forEach items="${searchedBook}" var="book">
<td>${book.book_author}</td>
</c:forEach>/span>
</tr>
</tbody>/span>
</table>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/308572.html
標籤:
下一篇:如何找到q范圍內有多少個數字
