velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Melehin Anton <>
Subject a problem with template loading
Date Sun, 10 Mar 2002 16:13:29 GMT
Hello All.

  I'm using Velocity 1.2 for 1 week.

  Yesterday, I've finished a simple servlet that uses VelocityServlet as base
  class. This servlet use 10 templates for its work. It
  load them by calling method getTemplate (for example getTemplate('html/show.vm.html') )
  of  VelocityServlet.

  When I deployed it to the test application, almost everything were fine for me.

  After that, I decided to deploy this servlet to my
  web-applications. I put servlet settings to the web.xml in 3
  other web-applications.

  There are separate templates for every
  applications. So in every .war were separate copy of my templates
  (html/). I made 3 .war and deployed them to the Tomcat 3.2.2. Everything
  were Ok, until I decided to change template in one of applications.
  I can see those changes in other applications!

  After that I read docs and understood that Velocity can use two
  'schemas' of using templates: engine for JVM
  2.separate engine for every application.

  Every servlet instance use same name ('html/show.vm.html') for
  different templates (phisically placed in diffrent locations)
  and I think that my templates were mixed between my applications?

  in the .loadConfiguration() method of the servlet I set path for template engine:

    String path = config.getServletContext().getRealPath("/");
    p.setProperty( Velocity.FILE_RESOURCE_LOADER_PATH,  path );

  So, I think my question is: How to use separate schema of loading
  templates in servlet that extends VelocityServlet?

  Is there other ways than renaming templates directories in every application to
  make them unique?

  Could anyone help me? Perhaps, problem in my servlet?

  Thank you.
  Anton Melehin.
Best regards,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message