tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: xml and date problem
Date Wed, 02 Jun 2004 17:41:28 GMT
I used JSTL 1.0 as well with TC 5.0.24 because I ran with a Servlet 2.3 web.xml.
Just for giggles, I tried it with TC 4.1.30 and it also worked fine. Are you
using the latest Standard 1.0 taglib? It's currently at 1.0.5.

Quoting David Goodenough <david.goodenough@btconnect.com>:

> On Wednesday 02 June 2004 17:52, Felix Velasco wrote:
> > have you tried this:
> >
> > <x:parse var="myxml">
> >   <test>
> >     <unit date="20040602142014">
> >       </unit>
> >     <unit date="20040602143809">
> >       </unit>
> >     </test>
> >   </x:parse>
> > <table>
> >   <x:forEach select="$myxml/test/unit">
> >       <TR>
> >         <TD>
> > 		<x:out select="@date" />
> >           </TD>
> >         </TR>
> >     </x:forEach>
> >   </TABLE>
> >
> > ,just to see if it's really an xml problem, or has something to do with
> the
> > "updated" var, the fmt tags?
> >
> 
> Tried this, and I get the correct answers.  So it is fmt problem.
> 
> BTW, I am using Tomcat4 and therefore the older JSTL code.
> 
> David
> 
> > -----Original Message-----
> > From: Felix Velasco [mailto:felix.velasco@kewill.com]
> > Sent: 02 June 2004 18:49
> > To: 'Tag Libraries Users List'
> > Subject: RE: xml and date problem
> >
> >
> > also worked for me, in Jetty (Servlet 2.3/JSP1.2) with far older Xerces
> and
> > Xalan version.....
> >
> > Xerces 1.4.3, Xalan 2.3.1
> >
> > -----Original Message-----
> > From: Kris Schneider [mailto:kris@dotech.com]
> > Sent: 02 June 2004 18:45
> > To: Tag Libraries Users List
> > Subject: Re: xml and date problem
> >
> >
> > I changed your example only to make it work more nicely as text output:
> >
> > <%@ page contentType="text/plain" %>
> > <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
> > <%@ taglib prefix="x"   uri="http://java.sun.com/jstl/xml" %>
> >
> > <x:parse var="xml">
> > <test>
> >     <unit date="20040602142014">
> >     </unit>
> >     <unit date="20040602143809">
> >     </unit>
> > </test>
> > </x:parse>
> >
> > <x:forEach select="$xml/test/unit">
> >     <fmt:parseDate var="updated" pattern="yyyyMMddHHmmss" type="both">
> >         <x:out select="@date" />
> >     </fmt:parseDate>
> >     <fmt:formatDate value="${updated}" pattern="yyyy-MM-dd HH:mm:ss" />
> > </x:forEach>
> >
> > And got:
> >
> > 2004-06-02 14:20:14
> > 2004-06-02 14:38:09
> >
> > So what's the problem? ;-) I used TC 5.0.24 (running in Servlet 2.3/JSP
> 1.2
> > mode) with Xerces 2.6.2 and Xalan 2.6.0 installed in common/endorsed. Try
> > upgrading Xerces and Xalan.
> >
> > Quoting David Goodenough <david.goodenough@btconnect.com>:
> > > I have a problem with either xml parsing or date formatting, I am not
> >
> > quite
> >
> > > sure which.
> > >
> > > Consider the following code:-
> > >
> > > <x:parse var="xml">
> > >   <test>
> > >     <unit date="20040602142014">
> > >       </unit>
> > >     <unit date="20040602143809">
> > >       </unit>
> > >     </test>
> > >   </x:parse>
> > > <table>
> > >   <x:forEach select="$xml/test/unit">
> > >     <fmt:parseDate var="updated" pattern="yyyyMMddHHmmss" type="both">
> > >       <x:out select="@date" />
> > >       </fmt:parseDate>
> > >       <TR>
> > >         <TD>
> > >           <fmt:formatDate value="${updated}" pattern="yyyy-MM-dd
> > > HH:mm:ss" />
> > >           </TD>
> > >         </TR>
> > >     </x:forEach>
> > >   </TABLE>
> > >
> > > One would expect this to produce:-
> > >
> > > 2004-06-02 14:20:14
> > > 2004-06-02 14:38:09
> > >
> > > but instead it produces:-
> > >
> > > 2004-06-02 14:20:14
> > > 2004-06-02 14:20:14
> > >
> > > i.e. it repeats the first date.  If there are more than two xml items it
> > > repeats the same date all the way through.
> > >
> > > Is this a known problem, and is there a fix?
> > >
> > > David

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Mime
View raw message