You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christofer 'boz' Jennings <bo...@cox.net> on 2005/03/24 21:27:11 UTC

Velocity template to Java?

Is there a way to generate Java code from a velocity template that 
produces the same output as the template?

I'm writing a report generator for TestNG. I have a template that makes 
HTML but in the end I don't need to support lots of templates. In fact 
i can get away with just one. On the other hand, TestNG is only about 
300k, so adding Velocity to the stack pretty much doubles the download. 
What I want to do is create two reporters. One in just Java. The other 
using Velocity, so folks can modify reports easily.

It'd be great if I could make the report template in Velocity, then 
generate a Java class from the template that produces the same output 
as the template. Is there anything like that available?

Thanks,
boz


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


Re: Velocity template to Java?

Posted by Will Glass-Husain <wg...@forio.com>.
Yes, I believe so.  I've never used it, but take a look at JWAA.

http://www.virtualschool.edu/jwaa

WILL

----- Original Message ----- 
From: "Christofer 'boz' Jennings" <bo...@cox.net>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, March 24, 2005 12:27 PM
Subject: Velocity template to Java?


> Is there a way to generate Java code from a velocity template that 
> produces the same output as the template?
> 
> I'm writing a report generator for TestNG. I have a template that makes 
> HTML but in the end I don't need to support lots of templates. In fact 
> i can get away with just one. On the other hand, TestNG is only about 
> 300k, so adding Velocity to the stack pretty much doubles the download. 
> What I want to do is create two reporters. One in just Java. The other 
> using Velocity, so folks can modify reports easily.
> 
> It'd be great if I could make the report template in Velocity, then 
> generate a Java class from the template that produces the same output 
> as the template. Is there anything like that available?
> 
> Thanks,
> boz
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>

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


Re: Velocity template to Java?

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi boz,

> Is there a way to generate Java code from a velocity template that
> produces the same output as the template?

None that I know of...

> I'm writing a report generator for TestNG. I have a template that makes
> HTML but in the end I don't need to support lots of templates. In fact
> i can get away with just one. On the other hand, TestNG is only about
> 300k, so adding Velocity to the stack pretty much doubles the download.
> What I want to do is create two reporters. One in just Java. The other
> using Velocity, so folks can modify reports easily.

What's another 300k in the age of the gigabytes?  You can fit it in a
floppy disk.  :)

#*
Or, you can make it a maven plugin and use the central repository approach.
    http://maven.apache.org/using/repositories.html
*#

> It'd be great if I could make the report template in Velocity, then
> generate a Java class from the template that produces the same output
> as the template. Is there anything like that available?

The best I can think of is to serialize the parsed template, but you
still will need the engine to render it.

## Of course, I won't stop you from creating a velocity2java project.  ;)

Best regards,
-- Shinobu

--
Shinobu Kawai <sh...@gmail.com>

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