velocity-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pablo Godoy <pgast...@gmail.com>
Subject Re: VTL
Date Tue, 17 Mar 2009 14:14:33 GMT
I finally found it...

I had to do this:

Velocity.evaluate(context, sw, "mystring", templateContents);

Regards!

2009/3/17 Pablo Godoy <pgastong@gmail.com>

> Hi all! I'm having troubles to merge a template and its parameters by using
> VTL.
>
> I did the next example that I found in the apache site:
>
> Velocity.init();
>
> VelocityContext context = new VelocityContext();
>
> context.put( "name", new String("Velocity") );
>
> Template template = Velocity.getTemplate("mytemplate.vm");
>
> StringWriter sw = new StringWriter();
>
> template.merge( context, sw );
>
>
> This example, worked ok.
>
> But the problem is that I already have the template contents given by
> parameter (I don't need to load the resource from the file system).
>
> What can I do? It's necesary to save the contents into a file, and then
> load it doing this?
> Velocity.getTemplate("templatePath");
>
> I wouldn't like to do it.
>
> Thanks to all!
>
> Regards!
>
> --
> Pablo Godoy
>



-- 
Pablo Godoy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message