A
queryCreateRows
action must be enclosed in a
queryBlock
action. A
queryCreateRows
action will iterate over the results of the last executed query and will
generate up to as many rows as requested.
A
queryDisplay
action must be enclosed in a
queryCreateRows
action. A
queryDisplay
action will access the requested field from the current iteration in
queryCreateRows
and insert the value into the out object.
FIGURE 1 2
A JSP page using custom actions
<%@ taglib uri= http://acme.com/taglibs/simpleDB.tld prefix= x %>
SELECT ACCOUNT, BALANCE FROM ...
The top 10 accounts and balances are:
In this example:
The x:queryCreateRows action implicitly refers to the object created by the
x:queryStatement within the same x:queryBlock
The x:queryDisplay actions refer to the current row in the query result that is being
iterated over by x:queryCreateRows
The code that locates a connection (perhaps from a connection pool), performs the
JDBC API query, and navigates through the result of this query is hidden in the
implementation of the custom actions. This encourages division of labor and isolation
from changes.
21
JavaServer Pages 1.1 Specification November 30, 1999
JSP Web Hosting JavaServer Pages Specifications JSP Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |