Your problem is not specific to Tapestry. You can use Velocity in a
Tapestry application just like you use anywhere else.

In this case, i think the problem is that your not setting the velocity
resource loader, and by default velocity tries to load the file you
provide from the current directory. I'm guessing that's not what you want.
You can see more information on this here
http://velocity.apache.org/engine/releases/velocity-1.5/developer-guide.html#configuring_resource_loaders

In the mean time, if for example you wanted to load the template from
the classpath you could do:

VelocityContext velocityContext = new VelocityContext();
Velocity.addProperty("resource.loader", "classpath");
Velocity.addProperty("classpath.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");

Template template = Velocity.getTemplate("email/email1.vm");

AngeloChen960 wrote:
> hi,
>
> I need to use velocity's template to format an email, something like this:
>
>  VelocityEngine ve = new VelocityEngine();
>  ve.init();
>  Template t = ve.getTemplate("email.vm");
> but always got :ResourceNotFoundException
> any idea how to use Velocity with Tapestry 5? thanks.
>
> A.C.
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to