You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Adrian Beech <a....@bigpond.net.au> on 2003/10/26 11:22:27 UTC

SQL query string appears as part of the HTML text when result set is empty

G'day folks,

I've been tinkering with taglibs for the first time today and I've come
across something that I cannot seem to find an answer to.  Basically
when ever a query returns an empty result set the SQL query string
itself is appearing as part of the HTML text.

The JSP contains the following snipet of code:

<P>
<TABLE WIDTH="480" BORDER="0">
  <TR>
    <TD WIDTH="480" COLSPAN="5" ALIGN="Left" VALIGN="Top"><FONT
SIZE="+1"><B>Requires Immediate Attention</B></FONT></TD>
  </TR>

  <TR BGCOLOR="#FF0000">
    <TD WIDTH="95" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Due</B></FONT></TD>
    <TD WIDTH="30" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF">&nbsp;</FONT></TD>
    <TD WIDTH="50" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Council</B></FONT></TD>
    <TD WIDTH="165" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Subject</B></FONT></TD>
    <TD WIDTH="140" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Contact Type</B></FONT></TD>
  </TR>

  <sql:statement id="stmtOverdue" conn="dbCon">
  <sql:query>SELECT * FROM OVERDUE_2 ORDER BY PRIORITY DESC,
TIME_DUE</sql:query>
  <sql:execute/>
  <sql:resultSet id="rsOverdue">
    <TR>
      <TD WIDTH="95" ALIGN="Left" VALIGN="Top"><sql:getTimestamp
colName="TIME_DUE" format="dd/MM/yyyy
HH:mm"/><sql:wasNull>?</sql:wasNull></TD>
      <TD WIDTH="30" ALIGN="Left" VALIGN="Top"><sql:getColumn
colName="ATTEMPTS"/></TD>
      <TD WIDTH="50" ALIGN="Left" VALIGN="Top"><sql:getColumn
colName="RCC_CODE"/></TD>
      <TD WIDTH="165" ALIGN="Left" VALIGN="Top"><A
HREF="OutboundContactServlet?action=followup&id=<sql:getColumn
colName="REQUEST_ID"/>"><sql:getColumn colName="SUBJECT"/></A></TD>
      <TD WIDTH="140" ALIGN="Left" VALIGN="Top"><sql:getColumn
colName="CONTACT_TYPE"/></TD>
    </TR>
  </sql:resultSet>
  <sql:wasEmpty>
    <TR>
      <TD WIDTH="480" COLSPAN="5" ALIGN="Left" VALIGN="Middle">There are
currently no overdue actions requiring attention.</TD>
  </  TR>
  </sql:wasEmpty>
</TABLE>
</P>
<sql:wasNotEmpty>
  <BGSOUND SRC="sounds/alert.wav" LOOP="4">
</sql:wasNotEmpty>
</sql:statement>

The resulting HTML looks like (generated from the code above):

<P>
<TABLE WIDTH="480" BORDER="0">
  <TR>
    <TD WIDTH="480" COLSPAN="5" ALIGN="Left" VALIGN="Top"><FONT
SIZE="+1"><B>Requires Immediate Attention</B></FONT></TD>
  </TR>

  <TR BGCOLOR="#FF0000">
    <TD WIDTH="95" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Due</B></FONT></TD>
    <TD WIDTH="30" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF">&nbsp;</FONT></TD>
    <TD WIDTH="50" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Council</B></FONT></TD>
    <TD WIDTH="165" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Subject</B></FONT></TD>
    <TD WIDTH="140" ALIGN="Left" VALIGN="Middle"><FONT
COLOR="#FFFFFF"><B>Contact Type</B></FONT></TD>
  </TR>

  SELECT * FROM OVERDUE_2 ORDER BY PRIORITY DESC, TIME_DUE
  
    <TR>
      <TD WIDTH="480" COLSPAN="5" ALIGN="Left" VALIGN="Middle">There are
currently no overdue actions requiring attention.</TD>
  </  TR>
  
</TABLE>
</P>

I'm running Tomcat 4.1.24 under Windows XP Pro.  Early today I
downloaded the DBTags binary and installed as per the instructions.  I'm
assuming the version of DBTags is 1.0 as this appears in the blurb in
the index.htm page.  The file name was "jakarta-taglibs-dbtags-current".

I'd be greatly appreciative if anyone can shed some light on why this is
happening.

AB



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