velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piyush Purang" <ppur...@gmail.com>
Subject Finding Templates
Date Thu, 06 Apr 2006 08:36:18 GMT
Hi,

Either I can't understand how velocity finds its templates (file
resources) or it is very limited in its capabilities.

I thought if I were to build the latest sources (I picked up the
sources from http://svn.apache.org/snapshots/jakarta-velocity/jakarta-velocity_20060405104817.tar.gz.)
and use that jar I could enhance the behaviour.

Ideally I'd like to give an absolute  path to velocity  engine and it
should be able to find it; if that is too much then a common parent
folder of all templates should be enough. Neither worked!

If velocity expects all my file-templates to lie in a single folder
then I have to say this is very very limiting especially when I want
to categorize my templates through folders.

Examples,

I am trying to access the template 'pgsql.vtl' lying under
'D:/netbeans/project/template/sql/'

These attempts don't work:

1.
velocityEngine.mergeTemplate(getFile().getAbsolutePath(), CHARSET,
context, resultStringWriter);

2. velocityEngine.setProperty("file.resource.loader.path",
"D:/netbeans/project/template/");

velocityEngine.mergeTemplate(getFile().getName(), CHARSET, context,
resultStringWriter);

(NOTE: It isn't D:/netbeans/project/template/sql/ but
D:/netbeans/project/template/)



Only the following works:

3. velocityEngine.setProperty("file.resource.loader.path",
"D:/netbeans/project/template/sql/");

velocityEngine.mergeTemplate(getFile().getName(), CHARSET, context,
resultStringWriter);


Questions:

I thought http://issues.apache.org/bugzilla/show_bug.cgi?id=17379 was
fixed and this will allow file-templates defined by absolute paths. Is
my assumption false?


Or am I missing a trick/config option that will help solve my problems?

Thanks.

Cheers
Piyush

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


Mime
View raw message