Hi All,
I have to fetch records from database and display on jsp page
in data grid.
Record can be displayed in tabular form in table.
How use datagrid in jsp.I have been searching for long time ,but
couldn't . It will be helpful if some could pass on the code .
Thanks
Regards
savita
Andrew Thompson - 29 Mar 2007 13:14 GMT
..
> How use datagrid in jsp.
Is that a statement or a question?
(Note the inclusion of '?' marks my
words as a question.)
In any case, probably much the same way
you might use a <TABLE> in <HTML>.
Andrew T.
Lew - 29 Mar 2007 13:26 GMT
> ..
>> How use datagrid in jsp.
[quoted text clipped - 5 lines]
> In any case, probably much the same way
> you might use a <TABLE> in <HTML>.
I suggest using <table> in <html>.
The other will work but is becoming deprecated.
-- Lew
savita - 29 Mar 2007 14:33 GMT
> ..
>
[quoted text clipped - 8 lines]
>
> Andrew T.
Thanks alot for you suggestion.
Thanks
Regards
Savita
voorth - 29 Mar 2007 14:38 GMT
> I have to fetch records from database and display on jsp page
> in data grid.
> Record can be displayed in tabular form in table.
> How use datagrid in jsp.I have been searching for long time ,but
> couldn't . It will be helpful if some could pass on the code .
The trick is using the "c:foreach" tag:
assuming you have a collection named "entries"
<c:if test="${not empty entries}">
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<c:forEach
var="entry"
varStatus="status"
items="${entries}"
>
<tr>
<td>${entry.column1}</td>
<td>${entry.column1}</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>