tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Amicabile <>
Subject RowCount in PageContext for DBTags - How?
Date Wed, 27 Jun 2001 19:01:52 GMT
Hi people

I'm using the DBtags and the utility tag libraries,
and what I want to achieve is printing the result of
a query in a textfield, retrieve the number of rows in
the resultset, and use it in the JSP page context
Can I do that using these tag libraries?

To be concrete

<sql:preparedStatement id="stmt2" conn="conn1">
    select surname, name, age from account
    order by 1
  <sql:resultSet id="rset1">
      <td><INPUT TYPE="TEXT"
NAME="name_<sql:rowCount/>" VALUE="<sql:getColumn
      <td><INPUT TYPE="TEXT"
NAME="surname_<sql:rowCount/>" VALUE="<sql:getColumn
      <td><INPUT TYPE="TEXT"
NAME="age_<sql:rowCount/>" VALUE="<sql:getColumn
	  <sql:wasNull>[no description]</sql:wasNull></td>

 <jLib:for varName="j"
begin="<%=<sql:rowCount/>%>" > 
      <td><INPUT TYPE="TEXT"
NAME="name_<%=j.intValue()%>" VALUE=""></td>
      <td><INPUT TYPE="TEXT"
NAME="surname_<%=j.intValue()%>" VALUE=""></td>
      <td><INPUT TYPE="TEXT"
NAME="age_<%=j.intValue()%>" VALUE=""></td>

Of course the line

<jLib:for varName="j"
begin="<%=<sql:rowCount/>%>" > 

 does not work. I should retrieve a variable from the
page context 
 <% int totalRows = <sql:rowCount/>; %>

 but that does not work. There should be a TEI class
in the tag library which gives me the number of rows,

something like <sql:rowCount id="rowCount1"/> would be
 <% int totalRows = rowCount1.intValue(); %>

 I see the dbtags puts the resultSet and the statement
in the page Context, but there is not a way, as far as
I see,
 to retrieve the number of the current row from these,
for instance through

<% int totalRows = rset1.getRowCount(); %>

As far as I can see, the ResultSetTag increments his
rowCount while retrieving the data.

Can you help me achieve what I want?


Do You Yahoo!?
Il tuo indirizzo gratis e per sempre su

View raw message