tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alex" <>
Subject Re: DBTags Tag library
Date Wed, 26 Sep 2001 16:12:30 GMT
Thank you Steve for the patch. It works for me too. I hope someone will hear us and include
it in the next release.
Best regards,

  ----- Original Message ----- 
  From: Mader, Steve 
  To: '' 
  Sent: Wednesday, October 24, 2001 6:39 PM
  Subject: RE: DBTags Tag library 

  I was having this same issue.  It seemed to only happen if the query first returned rows
and then I made another call to the same query (with different input) and it returned zero
rows.  Looking at the source for, it seemed to have something to do with
the processing of the end tag.  doEndTag() has the following code:

    public int doEndTag() throws JspTagException{
      try {
        if (getBodyContent() != null && getPreviousOut() != null) {
      } catch (IOException e) {
        throw new JspTagException(e.toString());
      } finally {
        try {
        catch (SQLException e) {
          // it's not fatal if the result set cannot be closed

      // we have to call this guy manually now
      // with the spec clarification

      return EVAL_PAGE;

  It seems the line that writes the body content is writing the content of the SQL query when
no rows are returned.  (getPreviousOut().write(getBodyContent().getString());) I modified
the if-block as follows and I no longer have the problem:

  if ( getBodyContent() != null &&
       getPreviousOut() != null &&
       _shouldLoop == true &&
       _rowCount > 0

  This may not be a perfect fix, but it's working for me.  I'm only using the ResultSet tag
for iterating over the result set (the loop attribute is true).

  Steve Mader
    -----Original Message-----
    From: alex []
    Sent: Sunday, September 23, 2001 7:55 AM
    Subject: DBTags Tag library 

    There is a small problem I saw when using DBTags library with JRun engine and IIS 5.0
and ODBC database access.
    What is happening: when I use a SELECT which does not return anything, so it's unsuccesful,
the generated webpage contains also the SELECT statement into it ! 
    Here is a piece of the code:

    <sql:statement id="stmt1" conn="conn1"> 
        SELECT Info_id, Details FROM Informative
     WHERE Type = 1
      <sql:resultSet id="rset1" >
        <sql:getColumn position="2"/><BR>
      <%String id =  rset1.getString(1);%>

    When there are no results, I get a string:
        SELECT Info_id, Details FROM Informative
     WHERE Type = 1

    Not very pretty, isn't it ? 
    I believe, but I may speak foolish things, that the context's output buffer is flushed
only inside a block where some results are obtained so the case when no results are returned
isn't considered.

    A last thing: I used wasEmpty AND/OR wasNotEmpty with no results in solving the problem.
I also observer that is not happening 100% ! Sometimes, somehow I managed to avoid this situation.

    I do not expect help on this matter ; maybe only a confirmation that this happens elswere.

    For Marius Scurtescu :
    Da-i inainte ca faci o treaba buna ! Ma bucur sa vad nume d'ale noastre pe aici.


View raw message