velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Reynolds" ...@twofeetthick.com>
Subject RE: Velocity DateTool Coding Examples
Date Thu, 28 Oct 2004 20:11:31 GMT
Hi John,

I was glad to see this recently discussed on the list. I believe i have all
the puzzle pieces but i'm having trouble fitting them together.

Let me simplify my application with an example.

Using struts and JSP, the struts action retrieves a list of Birthday
objects, where Birthday.java is a a simple pojo with just a “birthdate”
variable of type java.util.Date. This java.util.List is saved to a session
attribute, call it “birthdayView”. So in a very simple way, my template
would scroll through the items in the session object like this:

<vel:velocity>
#foreach ($birthday in $birthdayVIew)
             $birthday.birthdate  <br>
#end
</vel:velocity>

the code above just prints the unformatted toString() value of
$birthday.birthdate. Obviously, I want it to be formatted.

What I can’t crack is how to use the Date tool IN THE TEMPLATE to format
the string. Any help is appreciated.

Thanks very much
JR






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


Mime
View raw message