views:

30

answers:

1

Hi there,

I'm currently starting to learn to use java to create dynamic websites. I've started using a servlet and the template engine 'velocity'.

My Environement:

WebContent/
   WEB-INF/
      gallery/
         template.file

My Question: I want to use the "template.file" as template. WHAT filename/path do I have to enter to reach my template from a servlet.

Sorry for my bad english :/ It's currently very hot in germany.

Best regards, andre

EDIT: Some Code...

/* Create and setup the Template system */
template = new VelocityEngine();
template.init();
template.getTemplate("template.file"); <--- Waht directory to use
+2  A: 

Although WEB-INF/ is on the classpath, you cannot load templates without reconfiguring Velocity. Velocity uses a file-based approach by default. You need to tell Velocity to look on the classpath of the web application, which then uses the ServletContext to load resources packaged within the web application archive.

Please see the Velocity documentation about loading resources in web applications for a detailed description on how to configure Velocity to load templates from within a web application.

mhaller
thank you very much :)
Bigbohne