Java Reference
In-Depth Information
<c:forEach var="columnName"
<th><c:out value="${columnName}"/></th>
<!-- column data -->
<c:forEach var="row" items="${result.rowsByIndex}">
<c:forEach var="column" items="${row}">
<td><c:out value="${column}"/></td>
Notice that the generated <c:forEach> tags dynamically generate the table header
by invoking the getColumNames() method of the javax.servlet.jsp.jstl.
sql.Result interface as a JavaBean property. Similarly, the bi-dimensional array
returned by the getRowsByIndex() method is used to traverse the result set and
display its contents on the page.
Modifying Database Data with the
<sql:update> Tag
The JSTL <sql:update> tag allows us to modify database data either through SQL
INSERT , UPDATE , or DELETE statements. Just like other JSTL tags we have discussed
so far, the easiest way to use this tag with NetBeans is to drag the appropriate item
from the NetBeans palette into our page.
Inserting Database Data
To execute an INSERT statement, we can drag the DB Insert item from the NetBeans
palette into our page.
Search WWH ::

Custom Search