generate java class for a VTL template, is there any solution?

bluejoe2008 <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
Dear all,

    I am looking for a solution of generating a java class from a template written in VTL. 

    Below I descible the process how I want to use it:

1. I load a template from a.vtl which is written by user:

#set($b=$a+1)

2. then I use the generator tool Vtl2javaTool:

new Vtl2javaTool().generate("a.vtl", "test.A");

3. then I can use the test.A class:

cntext.put("a", 100);
Class.forName("test.A").newInstance().execute(context, writer); 
int b = context.get("b");

    is there any existing solution avaliable? Any comments from you are welcome. 
    many thanks!

2013-05-07 



bluejoe2008
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.