Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 38768 invoked from network); 28 Feb 2004 00:05:15 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 28 Feb 2004 00:05:15 -0000 Received: (qmail 4299 invoked by uid 500); 28 Feb 2004 00:04:53 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 4245 invoked by uid 500); 28 Feb 2004 00:04:53 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 4197 invoked from network); 28 Feb 2004 00:04:53 -0000 Received: from unknown (HELO mail.wrinkledog.com) (65.243.176.122) by daedalus.apache.org with SMTP; 28 Feb 2004 00:04:53 -0000 Received: (qmail 13156 invoked from network); 28 Feb 2004 00:06:35 -0000 Received: from c-67-171-181-164.client.comcast.net (HELO ?192.168.0.3?) (ml@67.171.181.164) by mail.wrinkledog.com with SMTP; 28 Feb 2004 00:06:35 -0000 Mime-Version: 1.0 (Apple Message framework v609) To: dev@cocoon.apache.org Message-Id: Content-Type: multipart/alternative; boundary=Apple-Mail-40-835248096 From: Mark Lundquist Subject: [JXTemplate] weird problem w/ formatDate Date: Fri, 27 Feb 2004 16:04:55 -0800 X-Mailer: Apple Mail (2.609) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --Apple-Mail-40-835248096 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Hi, (I'm using Cocoon 2.1.3...) I have something like this in a JXTemplate: and it barfs: Cannot format given Object as a Date But if I change the template to ...then I get this: Fri Feb 27 15:47:51 PST 2004 !!?!?!?! Clearly this is a Java Date object... Not only that, but... There are a number of places where dates have to display on this page. =20= I don't have a real model yet, so for right now I'm just prototyping=20 the "VC" of my "MVC" :-), using flow and JXTemplate, with mockup data=20 hardcoded in the flowscript. So anyway =97=A0currently all the date=20 objects that get passed in (via the context object passed to=20 sendPageAndWait) are the identical object. In the flowscript: var now =3D new Packages.java.util.Date(); So they're all 'now' (once again, intentionally), but some of the=20 'nows' JXTemplate chokes on, and some of them it's fine! So... here's what I tried next: 1) Created my own Java.text.DateFormat object in the flowscript, and=20 used it to format all my dates there 2) Changed the JXTemplate to use to interpolate all my date=20 displays, since they are now strings at this point. The result: nice dates, no problem. Mark --Apple-Mail-40-835248096 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=WINDOWS-1252 Hi, (I'm using Cocoon 2.1.3...) I have something like this in a JXTemplate: < and it barfs: Cannot format given Object as a Date But if I change the template to < ...then I get this: Fri Feb 27 15:47:51 PST 2004 !!?!?!?! Clearly this is a Java Date object... Not only that, but... There are a number of places where dates have to display on this page.=20= I don't have a real model yet, so for right now I'm just prototyping the "VC" of my "MVC" :-), using flow and JXTemplate, with mockup data hardcoded in the flowscript. So anyway =97=A0currently all the date objects that get passed in (via the context object passed to sendPageAndWait) are the identical object. In the flowscript: var now =3D new Packages.java.util.Date(); So they're all 'now' (once again, intentionally), but some of the 'nows' JXTemplate chokes on, and some of them it's fine! So... here's what I tried next: 1) Created my own Java.text.DateFormat object in the flowscript, and used it to format all my dates there 2) Changed the JXTemplate to use < to interpolate all my date displays, since they are now strings at this point. The result: nice dates, no problem. Mark --Apple-Mail-40-835248096--