velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raghushri Sankaran <raghus...@netscape.net>
Subject Concern regarding template path!
Date Sat, 12 Oct 2002 19:27:16 GMT
Hi All,
        I am just starting to use Velocity. I tried using the 1.3 
version but it gave me certain compilation problems when running the 
sample program provided in the manuals. I theninstalled the 1.1 version 
and everything worked fine. My only concern now is that I am trying to 
use it with ATG Dynamo application server. Id I just initialize velocity 
and merge the template , the template file is picked up from the app 
server home. This behaviour is expected, but when I try and give a 
relative path it does not work. Here is my code:

try{
      Properties p = new Properties();
      p.setProperty("file.resource.loader.path","/templates");
      Velocity.init(p);
      VelocityContext vc = new VelocityContext();
      vc.put("name","Superman");
      StringWriter w = new StringWriter();
      Velocity.mergeTemplate("t.vm",vc,w);
      System.out.println("Template is :"+w);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }

I get a ResourceNotFoundException even though my template t.vm is in 
<APPSERVERHOME>/templates directory. Can someone please help.


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message