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

Reply via email to