tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Thiel <>
Subject Re: Easy get method of record number
Date Wed, 24 Sep 2014 13:46:54 GMT
Hi Kazuaki,

Firstly, be real careful about using SQL taglibs. It very much goes
against the patterns discussed in class for the reasons discussed in

However, taglibs aside, I understand your concern. The main reason is
that the ResultSet can start getting processed immediately under some
conditions, thus it makes sense not to know the final number of
records because the database might not have counted the final number
of records. A corollary from that is that UI often only displays a
certain number of records and only wants a few at a time, so we can
often go a step further and use the LIMIT qualifier (available in many
sql implementations for that purpose).

The good news about the "SELECT COUNT(id)" syntax is that you don't
need ordering, and you're usually selecting on an index, even if not
the primary one, so it can do those counts pretty darn fast. The count
may also prime the next initial select query, on a good db.

On Wed, Sep 24, 2014 at 4:52 AM, Kazuaki Miyauchi <> wrote:
>  Hi, it seems there is no way to get the numbers of records without
> issuing count sql . It is convenient to get the number as following.
> <sql:query var="rsSelect" dataSource="${example}" sql="select
> firstName, address from member where id = 'aiueo';" />
>  <c:if test="${rsSelect.countNum == 0}" >
> ...
> Why is there no function to get record number?
> Regards,
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Stuart Thiel, P. Eng.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message