Java Reference
In-Depth Information
Just as we did in previous examples, we will drag the
DB Report
item from the
NetBeans palette into our page, so that we can see the effect the
DELETE
statement
had in the database. After doing so, the body of our page now looks like this:
<body>
<h2>Hello World!</h2>
<sql:update var="deletedRows" dataSource="jdbc/sample">
DELETE FROM customer
WHERE name like ?
<sql:param value="Ensode%"/>
</sql:update>
<sql:query var="result" dataSource="jdbc/sample">
SELECT customer_id, name, discount_code, zip FROM customer
where name like ?
<sql:param value="Ensode%" />
</sql:query>
<table border="1">
<!-- column headers -->
<tr>
<c:forEach var="columnName" items="${result.columnNames}">
<th><c:out value="${columnName}"/></th>
</c:forEach>
</tr>
<!-- column data -->
<c:forEach var="row" items="${result.rowsByIndex}">
<tr>
<c:forEach var="column" items="${row}">
<td><c:out value="${column}"/></td>
</c:forEach>
</tr>
</c:forEach>
</table>
</body>
After executing our page by right-clicking on it and selecting
Run File
from the pop
up menu, we can see the results of our
DELETE
statement.