[prev in list] [next in list] [prev in thread] [next in thread]
List: taglibs-dev
Subject: cvs commit: jakarta-taglibs/jdbc/doc/web index.html
From: morgand () apache ! org
Date: 2001-01-31 0:43:49
[Download RAW message or body]
morgand 01/01/30 16:43:49
Modified: jdbc/doc/web index.html
Log:
Removed all old setter/getter methods and added getColumn
and setColumn. Documentation now up to date.
Revision Changes Path
1.2 +544 -212 jakarta-taglibs/jdbc/doc/web/index.html
Index: index.html
===================================================================
RCS file: /home/cvs/jakarta-taglibs/jdbc/doc/web/index.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.html 2001/01/08 21:16:32 1.1
+++ index.html 2001/01/31 00:43:49 1.2
@@ -57,9 +57,9 @@
<%-- loop through the rows of your query --%>
<sql:resultSet id="rset2">
<tr>
- <td><sql:getString position="1"/></td>
- <td><sql:getString position="2"/></td>
- <td><sql:getString position="3"/>
+ <td><sql:getColumn position="1"/></td>
+ <td><sql:getColumn position="2"/></td>
+ <td><sql:getColumn position="3"/>
<sql:wasNull>[no description]</sql:wasNull></td>
</tr>
</sql:resultSet>
@@ -123,8 +123,9 @@
<P><I>2. Use a DataSource object</I></P>
-<P>The connection tag also accepts a reference to a page attribute containing
-a javax.sql.DataSource object:</P>
+<P>The connection tag also accepts a reference to a Servlet attribute containing
+a javax.sql.DataSource object. (The attribute is found via the
+findAttribute() method of PageContext.):</P>
<pre><%-- open a database connection --%>
<sql:connection id="conn1" dataSource="ds1">
@@ -216,48 +217,29 @@
</sql:query>
<sql:execute>
- <sql:setInt position="1">3</sql:setInt>
- <sql:setString position="2"><%=request.getParameter("book_title")%></sql:setString>
+ <sql:setColumn position="1">3</sql:setInt>
+ <sql:setColumn position="2"><%=request.getParameter("book_title")%></sql:setString>
</sql:execute>
</sql:preparedStatement></pre>
<p>One advantage of prepared statements is that you do not need to perform sql escaping on
-text, as you have to do in a standard statement. Also, prepared statements are the
-only way to insert complex values such as Blobs and Clobs into a database. However,
+text, as you have to do in a standard statement. However,
be aware that standard statements may be more performant for databases and drivers that
do not peform pooling of connections <i>and</i> prepared statements.</p>
-<p><b>set* tags</b></p>
+<p><b>setColumn tag</b></p>
-<p>You can put the set* tags of prepared statements either before the execute or
+<p>You can put the setColumn tags of prepared statements either before the execute or
resultset tag, or inside the execute tag. The execute tag never outputs its body
- so putting set* tags inside may prevent unnecessary whitespace.</p>
+ so putting setColumn tags inside may prevent unnecessary whitespace.</p>
-<p>There are two patterns for using "set*" tags. All set*
-tags (except setNull) allow you to set their value from an existing page
-attribute using the "name" tag attribute:
-
-<pre><%-- you have to use objects, no primitives --%>
-<% pageContext.setAttribute("theInt",new Integer(3)); %>
-<%-- pass the name of the page attribute to the setter tag --%>
-<sql:setInt position="1" name="theInt"/></pre>
-
-<p>In addition, most tags will let you set the value from the body of the tag. (If
-a particular "set*" tag does not support body content, you will get a compile-time
-error using the standard TLD.) Here's an example of setting an integer from the
-tag body:
-
-<pre><sql:setInt position="1">3</sql:setInt></pre>
-
-<p>You can find a complete list of the "set*" tags in the prepared statement section
-of the <a href="#summary">Tag Summary</a>.</p>
-
<A NAME="overview.tags.resultset"><h3>ResultSet Tags</h3></A>
<p>Result sets are the product of a select statement. The resultSet tag
-automatically loops, once per row, through a result set. Use the "get*"
-tags to grab values from each row and either display them or store them away:</p>
+automatically loops, once per row, through a result set. Use the "getColumn"
+tag to grab values from each row and either display them or store them away
+as a String:</p>
<pre><%-- print the rows in an HTML table --%>
<table>
@@ -271,9 +253,9 @@
<%-- loop through the rows of your query --%>
<sql:resultSet id="rset2">
<tr>
- <td><sql:getString position="1"/></td>
- <td><sql:getString position="2"/></td>
- <td><sql:getString position="3"/>
+ <td><sql:getColumn position="1"/></td>
+ <td><sql:getColumn position="2"/></td>
+ <td><sql:getColumn position="3"/>
<%-- print out a comment if the book has no description --%>
<sql:wasNull>[no description]</sql:wasNull></td>
</tr>
@@ -284,38 +266,32 @@
<p><b>the "wasNull" tag</b></p>
-<p>The "wasNull" tag only executes its body if the previous "get*" tag encountered a
+<p>The "wasNull" tag only executes its body if the previous "getColumn" tag encountered a
null value in the database. You can only use the "wasNull" tag if you are
-inside a resultset and if a "get*" tag has already been executed. Setting the
+inside a resultset and if a "getColumn" tag has already been executed. Setting the
optional "value" attribute to "false" means that the tag body will only be executed
if the previous get* tag did <i>not</i> produce a null.</p>
-<p><b>"get*" tags</b></p>
+<p><b>"getColumn" tag</b></p>
+
+<p>The getColumn tag performs one of two functions. You may either:</p>
+
+<ol>
+ <li><p>Write the column value directly to the JSP (default behavior)<p>
+
+ <pre><%-- Print the value to the JSP output --%>
+<sql:getColumn position="1"/></pre>
+
+ <p>, or</p>
+
+ <li>Write the column value, as a String, to a page attribute via the "to"
+ attribute. If you want, you may optionally assign a scope other
+ than "page" with the "scope" attribute. If the database column is null, the
+ getColumn tag <i>will not</i> create an attribute. Here's a getColumn tag that
+ creates an Integer request attribute:</p>
-<p>The "get*" tags behave similarly to the
-<a href="#overview.tags.preparedstatement">preparedStatement</a> "set*" tags. All
-get* tags can assign the value of the database column to a page attribute via the
-"to" tag attribute. Unlike the
-set* tags, get* tags can also optionally assign a scope other
-than "page" for the attribute If the database column is null, the get* tags
-<i>will not</i> create an attribute. Here's a get* tag that creates an
-Integer request attribute:</p>
-
-<pre><%-- Note that the request attribute will be an Integer object, not a primitive --%>
-<sql:getInt position="1" to="theInt" scope="request"/></pre>
-
-<p>Additionally, most tags can assign their value, as a String, directly to the
-JSP output by not setting a "to" attribute. (If a particular "get*" tag does not
-support this, it will throw a compile-time error using the standard TLD.) If the
-database column is null, the get* tag will print out nothing. Here's a
-get* tag that prints an Integer to the JSP output:</p>
-
-<pre><%-- Print the integer to the JSP output --%>
-<sql:getInt position="1"/></pre>
-
-<p>You can find
-a complete list of the "get*" tags in the resultset section
-of the <a href="#summary">Tag Summary</a>.</p>
+<pre><%-- Note that the request attribute will be a String --%>
+<sql:getColumn position="1" to="someId" scope="request"/></pre>
<p><b>disabling looping</b></p>
@@ -463,153 +439,32 @@
<TD COLSPAN="2"><B>PreparedStatement Only Tags</B></TD>
</TR>
<TR>
- <TD><A HREF="#query">preparedStatement</A></TD>
+ <TD><A HREF="#preparedStatement">preparedStatement</A></TD>
<TD>create and execute a tokenized database query</TD>
- </TR>
- <TR>
- <TD><A HREF="#setArray">setArray</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setAsciiStream">setAsciiStream</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setBigDecimal">setBigDecimal</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setBinaryStream">setBinaryStream</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setBlob">setBlob</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setBoolean">setBoolean</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setBytes">setBytes</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setByte">setByte</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setCharacterStream">setCharacterStream</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setClob">setClob</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setDate">setDate</A></TD>
</TR>
<TR>
- <TD><A HREF="#setDouble">setDouble</A></TD>
+ <TD><A HREF="#setColumn">setColumn</A></TD>
+ <TD>Set a column value in the SQL query</TD>
</TR>
<TR>
- <TD><A HREF="#setFloat">setFloat</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setInt">setInt</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setLong">setLong</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setNull">setNull</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setObject">setObject</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setRef">setRef</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setShort">setShort</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setString">setString</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setTimestamp">setTimestamp</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#setTime">setTime</A></TD>
- </TR>
- <TR>
<TD COLSPAN="2"> </TD>
</TR>
<TR>
<TD COLSPAN="2"><B>ResultSet Tags</B></TD>
</TR>
<TR>
- <TD><A HREF="#query">resultSet</A></TD>
+ <TD><A HREF="#resultSet">resultSet</A></TD>
<TD>loop through the rows of a select statement</TD>
</TR>
<TR>
- <TD><A HREF="#query">wasNull</A></TD>
+ <TD><A HREF="#wasNull">wasNull</A></TD>
<TD>execute the tag body if the last "get" tag encountered a null
in the database</TD>
</TR>
- <TR>
- <TD><A HREF="#getArray">getArray</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getAsciiStream">getAsciiStream</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getBigDecimal">getBigDecimal</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getBinaryStream">getBinaryStream</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getBlob">getBlob</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getBoolean">getBoolean</A></TD>
- </TR>
<TR>
- <TD><A HREF="#getBytes">getBytes</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getByte">getByte</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getCharacterStream">getCharacterStream</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getClob">getClob</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getDate">getDate</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getDouble">getDouble</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getFloat">getFloat</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getInt">getInt</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getLong">getLong</A></TD>
+ <TD><A HREF="#getColumn">getColumn</A></TD>
+ <TD>Gets a column value from the database</TD>
</TR>
- <TR>
- <TD><A HREF="#getObject">getObject</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getRef">getRef</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getShort">getShort</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getString">getString</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getTimestamp">getTimestamp</A></TD>
- </TR>
- <TR>
- <TD><A HREF="#getTime">getTime</A></TD>
- </TR>
</TABLE>
<A NAME="reference"><h1>Tag Reference</h1></A>
@@ -761,7 +616,7 @@
</TD>
</TR>
<TR>
- <TD COLSPAN="3">Sets the database url for the connection tag.</TD>
+ <TD COLSPAN="3">Sets the database URL of the enclosing connection tag.</TD>
</TR>
<TR>
<TD WIDTH="2%"> </TD>
@@ -781,21 +636,44 @@
</TR>
<TR>
<TD WIDTH="20%"><B>Attributes</B></TD>
- <TD WIDTH="80%">None</TD>
+ <TD WIDTH="80%"> </TD>
</TR>
<TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> initParameter</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Optional attribute, indicating the name of
+ an init parameter</TD>
+ </TR>
+ </table></td>
+ </TR>
+ <TR>
<TD WIDTH="20%"><B>Properties</B></TD>
<TD>None</TD>
</TR>
<TR>
<TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
<TD WIDTH="80%"><BR>
-<PRE>
-<pre><%-- open a database connection --%>
+<PRE><%-- example 1: using the tag body --%>
<sql:connection id="conn1">
<sql:url>jdbc:mysql://localhost/test</sql:url>
-</sql:connection></pre>
-</PRE>
+</sql:connection>
+
+<%-- example 2: using an init parameter --%>
+<sql:connection id="conn1">
+ <sql:url initParameter="dbURL"/>
+</sql:connection></PRE>
</TD>
</TR>
</TABLE>
@@ -835,7 +713,27 @@
</TR>
<TR>
<TD WIDTH="20%"><B>Attributes</B></TD>
- <TD WIDTH="80%">None</TD>
+ <TD WIDTH="80%"> </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> initParameter</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Optional attribute, indicating the name of
+ an init parameter</TD>
+ </TR>
+ </table></td>
</TR>
<TR>
<TD WIDTH="20%"><B>Properties</B></TD>
@@ -844,13 +742,17 @@
<TR>
<TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
<TD WIDTH="80%"><BR>
-<PRE>
-<pre><%-- open a database connection --%>
+<pre><%-- example 1: using the tag body --%>
<sql:connection id="conn1">
<sql:url>jdbc:mysql://localhost/test</sql:url>
<sql:driver>org.gjt.mm.mysql.Driver</sql:driver>
+</sql:connection>
+
+<%-- example 2: using an init parameter --%>
+<sql:connection id="conn1">
+ <sql:url initParameter="dbURL"/>
+ <sql:driver initParameter="dbDriver"/>
</sql:connection></pre>
-</PRE>
</TD>
</TR>
</TABLE>
@@ -891,7 +793,27 @@
</TR>
<TR>
<TD WIDTH="20%"><B>Attributes</B></TD>
- <TD WIDTH="80%">None</TD>
+ <TD WIDTH="80%"> </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> initParameter</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Optional attribute, indicating the name of
+ an init parameter</TD>
+ </TR>
+ </table></td>
</TR>
<TR>
<TD WIDTH="20%"><B>Properties</B></TD>
@@ -900,13 +822,17 @@
<TR>
<TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
<TD WIDTH="80%"><BR>
-<PRE>
-<pre><%-- open a database connection --%>
+<PRE><%-- example 1: using the tag body --%>
<sql:connection id="conn1">
<sql:url>jdbc:mysql://localhost/test</sql:url>
<sql:userId>root</sql:userId>
-</sql:connection></pre>
-</PRE>
+</sql:connection>
+
+<%-- example 2: using an init parameter --%>
+<sql:connection id="conn1">
+ <sql:url initParameter="dbURL"/>
+ <sql:userId initParameter="dbUserId"/>
+</sql:connection></PRE>
</TD>
</TR>
</TABLE>
@@ -946,20 +872,47 @@
</TR>
<TR>
<TD WIDTH="20%"><B>Attributes</B></TD>
- <TD WIDTH="80%">None</TD>
+ <TD WIDTH="80%"> </TD>
</TR>
<TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> initParameter</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Optional attribute, indicating the name of
+ an init parameter</TD>
+ </TR>
+ </table></td>
+ </TR>
+ <TR>
<TD WIDTH="20%"><B>Properties</B></TD>
<TD>None</TD>
</TR>
<TR>
<TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
<TD WIDTH="80%"><BR>
-<pre><%-- open a database connection --%>
+<pre><%-- example 1: using the tag body --%>
<sql:connection id="conn1">
<sql:url>jdbc:mysql://localhost/test</sql:url>
<sql:userId>root</sql:userId>
<sql:password>notVerySecure</sql:password>
+</sql:connection>
+
+<%-- example 2: using an init parameter --%>
+<sql:connection id="conn1">
+ <sql:url initParameter="dbURL"/>
+ <sql:userId initParameter="dbUserId"/>
+ <sql:password initParameter="dbPassword"/>
</sql:connection></pre>
</TD>
</TR>
@@ -1160,7 +1113,8 @@
<%-- set the SQL query --%>
<sql:query>
insert into test_books (id, name)
- values (3, '<sql:escapeSql><%=request.getParameter("book_title")%></sql:escapeSql>')
+ values (3,
+ '<sql:escapeSql><%= request.getParameter("book_title") %></sql:escapeSql>')
</sql:query>
<%-- execute the query --%>
<sql:execute/>
@@ -1219,7 +1173,8 @@
<%-- set the SQL query --%>
<sql:query>
insert into test_books (id, name)
- values (3, '<sql:escapeSql><%=request.getParameter("book_title")%></sql:escapeSql>')
+ values (3,
+ '<sql:escapeSql><%=request.getParameter("book_title")%></sql:escapeSql>')
</sql:query>
<%-- execute the query --%>
<sql:execute/>
@@ -1465,8 +1420,8 @@
values (?, ?)
</sql:query>
<sql:execute>
- <sql:setInt position="1">3</sql:setInt>
- <sql:setString position="2"><%=request.getParameter("book_title")%></sql:setString>
+ <sql:setColumn position="1">3</sql:setColumn>
+ <sql:setColumn position="2"><%=request.getParameter("book_title")%></sql:setColumn>
</sql:execute>
</sql:preparedStatement></pre>
</TD>
@@ -1475,6 +1430,383 @@
</TD>
</TR>
</TABLE>
+
+<TABLE BORDER="0" WIDTH="90%" CELLPADDING="3" CELLSPACING="0">
+ <TR>
+ <TD COLSPAN="2">
+ <TABLE BORDER="0" BGCOLOR="#CCCCCC" WIDTH="100%" CELLSPACING="0">
+ <TR>
+ <TD><B><FONT SIZE="+1"><A NAME="setColumn"> setColumn</A></FONT></B></TD>
+ <TD ALIGN="RIGHT">Availability: version 1.0 </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="2">Set a field in a preparedStatement. Set the value as a
+ String inside the tag body.</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="2%"> </TD>
+ <TD WIDTH="98%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="20%"><B>Tag Body</B></TD>
+ <TD WIDTH="80%">JSP</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Script Variable</B></TD>
+ <TD WIDTH="80%">No</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Restrictions</B></TD>
+ <TD WIDTH="80%">Use within the preparedStatement tag</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Attributes</B></TD>
+ <TD WIDTH="80%"> </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> position</B></TD>
+ <TD WIDTH="20%"> Yes</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Column position</TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR><TD WIDTH="20%"><B>Properties</B></TD><TD>None</TD></TR>
+ <TR>
+ <TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
+ <TD WIDTH="80%">
+ <br>
+
+<pre><%-- use the tag body --%>
+<sql:setColumn position="1"><%= someValue %></sql:setColumn></pre>
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+</TABLE>
+
+<TABLE BORDER="0" WIDTH="90%" CELLPADDING="3" CELLSPACING="0">
+ <TR>
+ <TD COLSPAN="2">
+ <TABLE BORDER="0" BGCOLOR="#CCCCCC" WIDTH="100%" CELLSPACING="0">
+ <TR>
+ <TD><B><FONT SIZE="+1"><A NAME="resultSet"> resultSet</A></FONT></B></TD>
+ <TD ALIGN="RIGHT">Availability: version 1.0 </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="2">JSP tag resulset, executes the query and loops through the results
+for the enclosing statement or preparedstatement tag. The body of
+this tag is executed once per row in the resultset. The optional
+"loop" attribute, which default to true, specifies whether to execute
+the tag body once per row "true", or to simply assign the ResultSet
+to the page attribute specified by "id".</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="2%"> </TD>
+ <TD WIDTH="98%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="20%"><B>Tag Body</B></TD>
+ <TD WIDTH="80%">JSP</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Script Variable</B></TD>
+ <TD WIDTH="80%">Yes (java.sql.ResultSet), available within the tag</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Restrictions</B></TD><TD>None</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Attributes</B></TD>
+ <TD WIDTH="80%"> </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> id</B></TD>
+ <TD WIDTH="20%"> Yes</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Script variable id for use with standard
+ <B>jsp:getProperty</B> tag, JSP version 1.2 (or equivalent, see
+ <A HREF="#Requirements">Requirements</A> for details)</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> loop</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">True: execute the tag body once per row in the
+ result set, automatically advancing the rows. False: execute
+ the tag body once.</TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR><TD WIDTH="20%"><B>Properties</B></TD></TR>
+ <TR>
+ <TD></TD>
+ <TD>
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="60%">Name</TD>
+ <TD WIDTH="20%">Get</TD>
+ <TD WIDTH="20%">Set</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="60%"><B> fetchSize</B></TD>
+ <TD WIDTH="20%"> Yes</TD>
+ <TD WIDTH="20%"> Yes</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">the number of rows that should be fetched from the
+ database when more rows are needed</TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
+ <TD WIDTH="80%">
+ <br>
+
+<pre><%-- open a database query --%>
+<table>
+<sql:statement id="stmt1" conn="conn1">
+ <sql:query>
+ select id, name, description from test_books
+ order by 1
+ </sql:query>
+ <%-- loop through the rows of your query --%>
+ <sql:resultSet id="rset2">
+ <tr>
+ <td><sql:getColumn position="1"/></td>
+ <td><sql:getColumn position="2"/></td>
+ <td><sql:getColumn position="3"/>
+ <sql:wasNull>[no description]</sql:wasNull></td>
+ </tr>
+ </sql:resultSet>
+</sql:statement>
+</table></pre>
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+</TABLE>
+
+<TABLE BORDER="0" WIDTH="90%" CELLPADDING="3" CELLSPACING="0">
+ <TR>
+ <TD COLSPAN="2">
+ <TABLE BORDER="0" BGCOLOR="#CCCCCC" WIDTH="100%" CELLSPACING="0">
+ <TR>
+ <TD><B><FONT SIZE="+1"><A NAME="wasNull"> wasNull</A></FONT></B></TD>
+ <TD ALIGN="RIGHT">Availability: version 1.0 </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="2">Executes its body if the last getColumn tag received a null value
+from the database. Setting the "value" attribute to false will
+execute the tag body if the last getColumn tag did not
+return a null. You must be inside a resultset tag and there must
+be a previous getColumn tag, or an error will be generated.</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="2%"> </TD>
+ <TD WIDTH="98%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="20%"><B>Tag Body</B></TD>
+ <TD WIDTH="80%">JSP</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Script Variable</B></TD>
+ <TD WIDTH="80%">No</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Restrictions</B></TD><TD>Must be used following a
+ getColumn tag.</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Attributes</B></TD>
+ <TD WIDTH="80%"> </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> value</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">If set to false, the body of the tag
+ will not be executed if the last getColumn
+ tag encountered a null.</TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR><TD WIDTH="20%"><B>Properties</B></TD><TD>None</TD></TR>
+ <TR>
+ <TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
+ <TD WIDTH="80%">
+ <br>
+
+<pre><%-- open a database query --%>
+<table>
+<sql:statement id="stmt1" conn="conn1">
+ <sql:query>
+ select id, name, description from test_books
+ order by 1
+ </sql:query>
+ <%-- loop through the rows of your query --%>
+ <sql:resultSet id="rset2">
+ <tr>
+ <td><sql:getColumn position="1"/></td>
+ <td><sql:getColumn position="2"/></td>
+ <td><sql:getColumn position="3"/>
+ <sql:wasNull>[no description]</sql:wasNull></td>
+ </tr>
+ </sql:resultSet>
+</sql:statement>
+</table></pre>
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+</TABLE>
+
+<TABLE BORDER="0" WIDTH="90%" CELLPADDING="3" CELLSPACING="0">
+ <TR>
+ <TD COLSPAN="2">
+ <TABLE BORDER="0" BGCOLOR="#CCCCCC" WIDTH="100%" CELLSPACING="0">
+ <TR>
+ <TD><B><FONT SIZE="+1"><A NAME="getColumn"> getColumn</A></FONT></B></TD>
+ <TD ALIGN="RIGHT">Availability: version 1.0 </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="2">Gets the value, as a String, of a coulmn in the enclosing
+resultset. The column number is set via the "position" attribute.
+You can optionally set the value, as a String, to a serlvet attribute
+instead of the tag body with the "to" attribute. The scope of the servlet
+attribute is specified by the "scope" XML attribute (default = page).</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="2%"> </TD>
+ <TD WIDTH="98%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="20%"><B>Tag Body</B></TD>
+ <TD WIDTH="80%">JSP</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Script Variable</B></TD>
+ <TD WIDTH="80%">No</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Restrictions</B></TD>
+ <TD WIDTH="80%">Use within the resultSet tag</TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"><B>Attributes</B></TD>
+ <TD WIDTH="80%"> </TD>
+ </TR>
+ <TR>
+ <TD WIDTH="20%"> </TD>
+ <TD WIDTH="80%">
+ <TABLE BORDER="0" WIDTH="100%">
+ <TR>
+ <TD WIDTH="40%">Name</TD>
+ <TD WIDTH="20%">Required</TD>
+ <TD WIDTH="40%">Runtime Expression Evaluation</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> position</B></TD>
+ <TD WIDTH="20%"> Yes</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Column position</TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> to</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Optionally assign the String to an attribute rather
+ than the JSP output.
+ </TD>
+ </TR>
+ <TR BGCOLOR="#CCCCCC">
+ <TD WIDTH="40%"><B> scope</B></TD>
+ <TD WIDTH="20%"> No</TD>
+ <TD WIDTH="40%"> No</TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">Optionally change the scope of the attribute designated
+ in "to" (default = page).
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR><TD WIDTH="20%"><B>Properties</B></TD><TD>None</TD></TR>
+ <TR>
+ <TD WIDTH="20%" VALIGN="TOP"><B>Example</B></TD>
+ <TD WIDTH="80%">
+ <br>
+
+<pre><%-- output to the JSP directly --%>
+<sql:getColumn position="1"/></pre>
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+</TABLE>
+
<A NAME="examples"><h1>Examples</h1></A>
<P>See the example application jdbc-examples.war for examples of the usage
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic