I want to take some data from the database and arrange it into rows with each row having 4 columns. Tables or css come to mind. By the way, I do not need borders.
What's a clean way to do this? If I use tables, I would have to count how many cells have been done in a ro开发者_如何学JAVAw and in the last row add some empty cells to that row. Right? What is a better way?
I am using Spring MVC JSPs and looked at the associated docs. http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/view.html
Thanks!
rendering data in jsp using spring controllers and different classes
I think it answer your question completely.
I would suggest something like this:
<table id="list">
<thead class="dataTableHeader">
<tr>
<td><fmt:message key="items.header"/></td>
</tr>
</thead>
<tbody>
<c:if test="${fn:length(yourForm.items.count) < 4}">
<tr>
//add some empty rows
</tr>
</c:if>
<c:forEach var="item" items="${yourForm.items}">
<tr>
<td>${item.id}</td>
// and other colums
</tr>
</c:forEach>
</tbody>
精彩评论