[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglibs-user
Subject:    Some questions
From:       David Goodenough <david.goodenough () btconnect ! com>
Date:       2002-02-04 12:14:05
[Download RAW message or body]

I am doing a proof of concept moving some JSP code from IBM Websphere
to Tomcat and I thought I would try dbtags to replace the tsx tags that IBM
provide as the tsx tags are not available for native Tomcat (as far as I
know).

In doing the conversion I have hit a number if problems, some of which were
easy to resolve, but others either had no obvious solution or raised 
suggestions for enhacements for dbtags.  So here is the list:-

1) wasEmpty and wasNotEmpty.  The single case of (not)empty strikes me
as less than is needed.  There are for instance many cases where you
are expecting just one row, and there is no easy way to validate that.
However I would suggest that there are also cases where other fixed numbers
are expected, and so rather than just add was(Not)SingleRow it would be
better to have a general mechanism.

2) Large ResultSets.  JDBC 2.0 added the absolute and relative methods
for navigating around large ResultSets, dbtags does not seem to provide
access to these methods.  I have a result set which is of very variable
size, from just a few to many hundred.  Displaying all at once was seen
by the users as a problem, so I was asked to put in a scrolling mechanism.
This I did as the ResultSet object in the tsx case had a getValue( col, row)
method, which I could use to index around the ResultSet.  As it happened 
I always went upwards from a starting point, until I had the window size
number of columns.  Before you say that I should put the result into a
Vector and pass that from invocation to invocation, they specifically 
wanted the query re-issued each time.  So perhaps we need some kind of 
start attribute, and possible a count attribute, so that the ResultSet
could be positioned before the loop starts, and limited as to the maximum
number of returned rows.  The alternative would be to do the looping 
myself in Java code rather than using the tags, but that rather defeats
the purpose of having tags.

3) returns on wasEmpty.  In one part of my code I wanted to forward to
another JDP page if the result of a query was empty.  So I coded:-

<sql:wasEmpty>
  <jsp:forward page="another.jsp" />
  <% return; %>
  </sql:wasEmtpy>

to replace:-

<% if( users.size( ) == 0)
     { %>
       <jsp:forward page="another.jsp" />
<%     return;
       }
  %>

but the JSP compiler complains about an unreachable line I guess after
the return.  What I found without the return in the original code was
that it tried to execute the rest of the JSP page, and in this case
I do not want it to execute, rather I want the other page immediately.

I could not find any discussion of these items with google, so I hope
that I have not missed prior discussion of these points.

Thank you in advance.

David

--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic