cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject [JXTemplate] weird problem w/ formatDate
Date Sat, 28 Feb 2004 00:04:55 GMT
Hi,

(I'm using Cocoon 2.1.3...)

I have something like this in a JXTemplate:

	<jx:formatDate value="${theDate}" />

and it barfs:

	Cannot format given Object as a Date

But if I change the template to

	<jx:out value="${theDate}" />

...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.  
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 — currently all the date 
objects that get passed in (via the context object passed to 
sendPageAndWait) are the identical object. In the flowscript:

	var now = 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 <jx:out> to interpolate all my date 
displays, since they are now strings at this point.

The result: nice dates, no problem.

Mark

Mime
View raw message