A variable that prints a string starting with "[B" is likely a primitive
byte array (byte[]).  This means that the MYSQL JDBC driver you're using
is probably returning a byte[] for the column aliased "Date" when it's
retrieved using ResultSet.getObject().  You could add

  <c:out value="${row.Date.class}" />

to the loop just to be sure.

I'm not sure this is anything the JSTL RI can address.  If DBTags works
with exactly the same JDBC driver, it might be that the critical
difference is that the driver returns a usable string when its ResultSet's
getString() method is called; I believe DBTags uses getString() where we
use getObject().

If you let me know specifically what MySQL JDBC driver you're using (a
pointer to its URL would be all I need), I can attempt to trace the
problem further and perhaps resolve the issue with the driver's
maintainers.  (Or, of course, my own replication of the problem could show
that it's really our bug.)

Thanks for the report,

-- 
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this summer from Manning Publications)

On Mon, 1 Apr 2002, Zvolensky, Thomas J {PDBI~Nutley} wrote:

> I have a query that selects records from a datetime column using the JSTL
> and MYSQL.  When I output the rows to a JSP page I'm getting the following:
> 
> Anderau, Eoma                 BASEL [B@b6421 
> Andersson, Lisa               BASEL [B@5acb2b 
>                                       [B@5092c0 
>                                       [B@52883b 
>                                       [B@6e1775 
>                                       [B@462631 
>                                       [B@756456 
> Andrews, Stella WELWYN                [B@e6899 
>                                       [B@752125
> 
> The last column should display a date (dd-mmm-yy).
> 
> My JSP code looks like this:
> 
> <sql:query var="visitor" dataSource="${example}">
> select distinct Authentications.userid,
> DATE_FORMAT(Authentications.authtime,'%d,%b,%y') as Date, UserInfo.*,
> UserInfo.firstname from Authentications,UserInfo
> where (UserInfo.userid=Authentications.userid) and
> (Authentications.docbase='eurpr1') 
> and UserInfo.userid NOT in ('eurpr1','erispre','dmadmin') order by
> UserInfo.lastname,Date
> </sql:query>
> .
> .
> .
> <!-- Loop through the rows of the query and display in the table -->
> 
> <c:set var="oldname" value=""></c:set>
> <c:forEach var="row" items="${visitor.rows}">
> <c:set var="newname" value="${row.lastname}"></c:set>
> 
> <!-- New user encountered, print name and location -->
> <c:if test="${newname != oldname}">
>       <tr>
>               <td align="left"><c:out
> value="${row.lastname}"/>,&nbsp;<c:out value="${row.firstname}"/></td>
>               <td align="left"><c:out value="${row.city}"/></td>
>               <td align="left"><c:out value="${row.Date}"/></td>
>      </tr>
> </c:if>
> 
> <!-- Same user.  List visit date only -->
> <c:if test="${newname == oldname}">
>       <tr>
>               <td align="left">&nbsp;</td>
>               <td align="left">&nbsp;</td>
>               <td align="left"><c:out value="${row.Date}"/></td>
>      </tr>
> </c:if>
> <c:set var="oldname" value="${row.lastname}"></c:set>
> 
> </c:forEach>
> 
> Is a conversion from datetime/date format to text required before the <c:out
> value="${row.Date}"/> tag?  If I run the same query and list the records
> using th DBTAGS library, the date comes out correct.
> 
> TIA


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to