Summary: | dbtags:resultset behaves strangely --> DBTags Deprecation request | ||
---|---|---|---|
Product: | Taglibs | Reporter: | Martin van Dijken <mvdijken> |
Component: | DBTags Taglib | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | mvdijken |
Priority: | P3 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other |
Description
Martin van Dijken
2003-09-04 09:14:11 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"> <p> <sql:getColumn colName="app_title"/><br> </p> </sql:resultSet> <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. From Mickael: Hello, 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. example: 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"> <%-- THIS QUERY RETURNS THE UserID --%> <sql:query> SELECT UserID FROM Users WHERE username = 'test' </sql:query> <sql:resultSet id="getUserIDTest"> <sql:getNumber position="1" to="userIDTest"/> </sql:resultSet> </sql:statement> <sql:statement id="getUserToto" conn="myConn"> <%-- THIS QUERY IS EMPTY --%> <sql:query> SELECT UserID FROM Users WHERE username = 'toto' </sql:query> <sql:resultSet id="getUserIDToto"> <sql:getNumber position="1" to="userIDToto"/> </sql:resultSet> </sql:statement> 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 m.cappozzo@netunion.com 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 containers." 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. |