Bug 22927 - dbtags:resultset behaves strangely --> DBTags Deprecation request
Summary: dbtags:resultset behaves strangely --> DBTags Deprecation request
Status: RESOLVED DUPLICATE of bug 26863
Alias: None
Product: Taglibs
Classification: Unclassified
Component: DBTags Taglib (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2003-09-04 09:14 UTC by Martin van Dijken
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Martin van Dijken 2003-09-04 09:14:11 UTC
I've posted about this in the taglibs user group, and will paste the original
message below. After that I'll put Mickael Cappozzo's message to the group that
demonstrates the exact same behaviour.
Comment 1 Martin van Dijken 2003-09-04 09:16:27 UTC
I've got a servlet that creates a resultset and then puts this resultset in the
request attributes under "results". In the page I've got these tags:

<sql:resultSet name="results" id="rslts">
   <sql:getColumn colName="app_title"/><br>
<sql:wasEmpty><p>No results found</p></sql:wasEmpty>

I figure this should loop the content of the resultset if anything can be found
and if the resultset was null, then the sql:wasEmpty should be displayed. 

Over to the problem. The jsp behaves exactly as expected when the server has
just been reboot. However, after the first time someone has found any results at
all, things go haywire when no results can be found. When no results can be
found, the sql:resultset displays some random blurb. Sometimes this will be the
body of the previous sql:resultset. At other times the body of fmt:bundle is
displayed. It looks as if the body of the last succesfully processed tag is
displayed again somehow.

I can't really figure out whether this is a bug of the sql tag, an error in the
BodyTagSupport class or of course something I'm doing wrong. 
Comment 2 Martin van Dijken 2003-09-04 09:18:44 UTC
From Mickael:


We wanted to migrate from tomcat 4.0 to tomcat 4.1.24, but we encoutered 
the following problem:
When a query return nothing, the query's body is displayed on the JSP 
page if the page contains another query returning something.

In the table Users,  we don't have user with username "toto" and with 
have a user with username "test" if we write the following in a jsp page:

<sql:statement id="getUserTest" conn="myConn">
      FROM Users
      WHERE username = 'test'
  <sql:resultSet id="getUserIDTest">
    <sql:getNumber position="1" to="userIDTest"/>

<sql:statement id="getUserToto" conn="myConn">
   <%-- THIS QUERY IS EMPTY --%>
      FROM Users
      WHERE username = 'toto'
  <sql:resultSet id="getUserIDToto">
    <sql:getNumber position="1" to="userIDToto"/>

On the page we saw:
    SELECT UserID FROM Users WHERE username = 'toto'

We noticed the following: if we add an attribute: loop, scope or another 
existing attribute in the resultSet tag in the empty query, the query is 
not displayed on the JSP page. However if we add this attribute to each 
resultSet tag, the query is displayed...

Any idea???

Mickaël Cappozzo
Comment 3 Martin van Dijken 2003-09-05 07:21:39 UTC
I received this quote in the taglibs-user-list about dbTags.

Morgan Delagrange:

"If you are using a recent implementation of the
Servlet specification, you should use Apache's
implementation of the JSTL, not DBTags.  DBTags has
been inactive since development on JSTL began, and it
should be considered deprecated for Servlet 2.3 or 2.4

I never thought about the fact that JSTl also had sql-tags, so I never even
looked there and went straight for dbTags. It might be nice to put a big fat
warning at the beginning of the dbtags documentation saying they are deprecated.
Comment 4 Felipe Leme 2004-02-27 06:05:38 UTC

*** This bug has been marked as a duplicate of 26863 ***