Sufi,

This was from the link I sent you:

"wasEmpty" and "wasNotEmpty" tags

The "wasEmpty" tag only executes its body if the last ResultSet tag
received 0 rows from the database. You must be after a resultSet tag, or an
error will be generated. The "wasNotEmpty" tag executes its body if the
last ResultSet received more than 0 rows from the database. See the Tag
Reference for examples.

"rowCount" tag

The "rowCount" tag prints out the number of rows retrieved from the
database. It can be used inside a ResultSet tag to provide a running count
of rows retreived, or after the ResultSet tag to display the total number.
See the Tag Reference for examples. Using the tag before the ResultSet will
produce an error.


wasEmpty  Availability: 1.0

Executes its body if the last ResultSet tag received 0 rows from the
database. You must be after a ResultSet tag, or an error will be generated.
Tag Body JSP
Restrictions

Use after a ResultSet tag.
Attributes None
Variables None
Examples




<%-- showing the contents of the table --%>
<table>
<tr><th>id</th><th>name</th><th>description</th></tr>
<sql:preparedStatement id="stmt6" conn="conn1"> <sql:query>
select id, name, description from test_books
   </sql:query>
<sql:resultSet id="rset4">
<tr>
<td><sql:getColumn position="1"/></td>
<td><sql:getColumn position="2"/></td>
<td><sql:getColumn position="3" to="description"/></td>
</tr>
</sql:resultSet>
<tr>
<td colspan="3">
<%-- show different text, depending on whether or not
     any rows were retrieved --%>
<sql:wasEmpty>No rows retrieved.</sql:wasEmpty>
<sql:wasNotEmpty><sql:rowCount/> rows retrieved.</sql:wasNotEmpty>
</td>
</tr>
</sql:preparedStatement>

wasNotEmpty Availability: 1.0

Executes its body if the last ResultSet tag received more than 0 rows from
the database. You must be after a ResultSet tag, or an error will be generated.
Tag Body JSP
Restrictions

Use after a ResultSet tag.
Attributes None
Variables None
Examples




<%-- showing the contents of the table --%>
<table>
<tr><th>id</th><th>name</th><th>description</th></tr>
<sql:preparedStatement id="stmt6" conn="conn1"> <sql:query>
select id, name, description from test_books
   </sql:query>
<sql:resultSet id="rset4">
<tr>
<td><sql:getColumn position="1"/></td>
<td><sql:getColumn position="2"/></td>
<td><sql:getColumn position="3" to="description"/></td>
</tr>
</sql:resultSet>
<tr>
<td colspan="3">
<%-- show different text, depending on whether or not
     any rows were retrieved --%>
<sql:wasEmpty>No rows retrieved.</sql:wasEmpty>
<sql:wasNotEmpty><sql:rowCount/> rows retrieved.</sql:wasNotEmpty>
</td>
</tr>
</sql:preparedStatement>

rowCount Availability: 1.0

Prints out the number of rows retrieved from the database. It can be used
inside a ResultSet tag to provide a running count of rows retreived, or
after the ResultSet tag to display the total number. Using the tag before
the ResultSet will produce an error.
Tag Body empty
Restrictions

Use inside or after a ResultSet tag (not before).
Attributes None
Variables None
Examples




<%-- showing the contents of the table --%>
<table>
<tr><th>id</th><th>name</th><th>description</th></tr>
<sql:preparedStatement id="stmt6" conn="conn1"> <sql:query>
select id, name, description from test_books
   </sql:query>
<sql:resultSet id="rset4">
<tr>
<td><sql:getColumn position="1"/></td>
<td><sql:getColumn position="2"/></td>
<td><sql:getColumn position="3" to="description"/></td>
</tr>
</sql:resultSet>
<tr>
<td colspan="3">
<%-- show different text, depending on whether or not
     any rows were retrieved --%>
<sql:wasEmpty>No rows retrieved.</sql:wasEmpty>
<sql:wasNotEmpty><sql:rowCount/> rows retrieved.</sql:wasNotEmpty>
</td>
</tr>
</sql:preparedStatement>


It shows how to use wasEmpty and rowCount if you look at the examples.

Regards,

Richard


At 12:54 AM 5/22/2002 +0000, you wrote:
>Hi,
>No that was for wasNull, what I am asking for is rowCount and wasEmpty.
>thank you anyway.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to