velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Creto <>
Subject Working with POJO with a calendar field
Date Thu, 01 Sep 2011 03:30:59 GMT

  I would like to get some hints, about working with java.util.Calendar.

Let’s say I have an object like this:

Public class Subscriber {
   Private String name;
   Private Calendar birthday;

I would like to use this field in a template, without having to go through a
DateTool kinda thing. By that I mean, instead of having to pass a DateTool
in my context, then in my template use it with something like
$myDateTool.format(‘yyyy-MM-dd’, $subscriber.birthday), I would like to use
something shorter, like $subscriber.birthday, and get it formatted
automatically to something humanly readable. Is this possible? Can I
register a class somewhere telling Velocity that if he needs to handle a
java.util.Calendar, format it a certain way?

Thank you in advance

Jean-Francois Croteau

View this message in context:
Sent from the Velocity - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message