[prev in list] [next in list] [prev in thread] [next in thread]
List: taglibs-user
Subject: RowCount in PageContext for DBTags - How?
From: Diego Amicabile <diegoami () yahoo ! it>
Date: 2001-06-27 19:01:52
[Download RAW message or body]
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,
so
something like <sql:rowCount id="rowCount1"/> would be
possible.
<% 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?
Greetings
Diego
______________________________________________________________________
Do You Yahoo!?
Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic