Java Reference
In-Depth Information
<!-- 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>
Notice that inside the body of the <sql:query> tag we added an <sql:param>
tag, this tag is used to dynamically substitute items in the WHERE clause of the SQL
SELECT statement in the tag, similar to the way the java.sql.PreparedStatement
interface works. In the query, question marks are used to indicate parameters that
need to be substituted with <sql:param> tags. Should our query have multiple
parameters (for example, when the values of two or more columns are used in its
WHERE clause), we can use a question mark for each parameter in the query. The
body of the <sql:query> tag must have a <sql:param> tag for each question mark
in the query, the first <sql:param> will contain the value for the first question mark,
the second one will contain the value for the second question mark, and so forth.
The value attribute of the <sql:param> tag can contain a String literal or a JSTL
expression.
By deploying our application and pointing the browser to our page (or simply
right-clicking on the page and selecting Run File ), we can see the <sql:update>
tag in action.
Every time we reload our page, a new row is added to the database, and the table on
the page is updated accordingly.
 
Search WWH ::




Custom Search