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">
  <sql:query>
    select surname, name, age from account
    order by 1
  </sql:query>
  <sql:resultSet id="rset1">
    <tr>
      <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 
position='3'/>"
      <sql:wasNull>[no description]</sql:wasNull></td>
    </tr>
  </sql:resultSet>


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

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?

Greetings
Diego

Reply via email to