Re: [htmltmpl-java] Exception: No such file or directory
Status: Beta
Brought to you by:
bluesmoon
From: Philip T. <phi...@gm...> - 2006-06-02 13:43:07
|
Sometime Today, cobbled together some glyphs to say: > I am almost there! ... I just have one thing I need to figure out. My > application is in: > > /usr/share/tomcat5/webapps/todo > > And my templates is in the same directory. For example, I have a template > named projects.tmpl. But my application can't find the template, so I > printed out the current directory: > > out.print(System.getenv("PWD")); > > The above command returns: /usr/share/tomcat5 > > So I need to add "webapps/todo" in front of every template filename... of > cause I don't want to do that. Instead I would like to make the > application believe that it's root directory is > /usr/share/tomcat5/webapps/todo. You can just tell HTML.Template where to look for templates by passing the "path" key to your Template constructor: String [] template_init = { "filename", "my_template.tmpl", "path", "webapps/todo", "search_path_on_include", "true" }; Template t = new Template(template_init); Hope this helps. Philip -- As long as we're going to reinvent the wheel again, we might as well try making it round this time. - Mike Dennison |