tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Rowcount from DBtags in the pageContext - How(?)
Date Tue, 26 Jun 2001 18:15:28 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 position='1'/>"</td>
      <td><INPUT TYPE="TEXT" NAME="surname_<sql:rowCount/>" 
VALUE="<sql:getColumn position='2'/>"</td>
      <td><INPUT TYPE="TEXT" NAME="age_<sql:rowCount/>" VALUE="<sql:getColumn

      <sql:wasNull>[no description]</sql:wasNull></td>

 <jLib:for varName="j" iterations="<%=<sql:rowCount/>+5%>" 
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" iterations="<%=<sql:rowCount/>+5%>" 
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.
 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?


View raw message