Bug 26863

Summary: error in ResultSetTag if ResultSet is empty
Product: Taglibs Reporter: ttor
Component: DBTags TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: JSmith, mvdijken, pazdzior, sqlweb2000, tivv
Priority: P3    
Version: 1.0B1   
Target Milestone: ---   
Hardware: PC   
OS: other   
Attachments: JSP page that reproduces the error (must have hsqldb.jar on WEB-INF/lib)
Output of the test case with dbtags-b1.jar
Output of the test case after the patch

Description ttor 2004-02-11 16:41:26 UTC
I create ResultSet object in servlet and save it in requests scope:
PreparedStatement pstmt;
...
ResultSet searchResults = pstmt.executeQuery();
request.setAttribute("searchResults", searchResults);
Then in jsp:
<sql:resultSet id="rs1" name="searchResults" scope="request">
<sql:getColumn colName="name"/><br>
</sql:resultSet>

It works fine, if searchResults has any records. If searchResults is empty, 
then once again will be output the result from the previous call to 
<sql:resultSet>. 

I have already made changes in my local copy of ResultSetTag.java to fix this 
problem and it works. If you interested, I can mail you my changes.

Good luck.
Comment 1 Felipe Leme 2004-02-11 18:40:15 UTC
Hmm, that looks like a container caching problem, similar to bug belo (on <c:out>):


http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26320
Comment 2 Vit Timchishin 2004-02-12 15:11:13 UTC
Yes, this is the bug I've reported long ago:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16830. I've even created a
fix, but noone seems to care.
Comment 3 Felipe Leme 2004-02-25 22:36:15 UTC
Ok, I did a fix similar to that one mentioned on bug 26320: I'm calling
super.bodyContent = null at doStartTag().

Is that the fix you have in mind?


Comment 4 Felipe Leme 2004-02-25 22:37:06 UTC
Created attachment 10555 [details]
JSP page that reproduces the error (must have hsqldb.jar on WEB-INF/lib)
Comment 5 Felipe Leme 2004-02-25 22:41:02 UTC
Created attachment 10556 [details]
Output of the test case with dbtags-b1.jar
Comment 6 Felipe Leme 2004-02-25 22:42:09 UTC
Created attachment 10557 [details]
Output of the test case after the patch
Comment 7 Felipe Leme 2004-02-26 12:48:09 UTC
Committed change on CVS (will appear on next nightly build)
Comment 8 Felipe Leme 2004-02-26 19:42:01 UTC
*** Bug 21647 has been marked as a duplicate of this bug. ***
Comment 9 Felipe Leme 2004-02-27 03:13:38 UTC
*** Bug 18767 has been marked as a duplicate of this bug. ***
Comment 10 Felipe Leme 2004-02-27 06:05:40 UTC
*** Bug 22927 has been marked as a duplicate of this bug. ***
Comment 11 Felipe Leme 2004-02-27 13:47:08 UTC
*** Bug 4877 has been marked as a duplicate of this bug. ***