logo       

Re: velocity.properties: msg#00176

jakarta.velocity.user

Subject: Re: velocity.properties

Hi,

I had the same problem, and this was my solution:
I have a directory with this structure
tomcat/webapps/myApplication
in the myApplication directory I made another dir, templates and put my
templates in there (of course, Velocity was unable to find them).

In the class where you init your Velocity engine, use the following line of
code:

String path= new String(request.getRealPath("/")); //this gets the path
where your servlet is runnig - note that this is a deprecated method

Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path); //use this
to tell Velocity in which dir to look

and finally, you should be able to do something like this:

Template template = null;

try {

template = Velocity.getTemplate("templates\\yourtemplate");



hope this works, it worked for me...


Jan



----- Original Message -----
From: "Florian Suschetz" <florian.suschetz@xxxxxxxxxxxxxxxxx>
To: <velocity-user@xxxxxxxxxxxxxxxxxx>
Sent: Tuesday, November 26, 2002 3:22 PM
Subject: velocity.properties


> Hi People!
> I would be verry happy, if you could help me with my problem:
>
> Is there any way to to tell velocity to use another velocity.properties
> file without editing a property/config-file of the servlet runner?
> At my app velocity does not find the templates!
> The velocity.properties file in the jar package of velocity says:
> file.resource.loader.path = .
> What is meant with this? Wehere must the templates be with this default
> setting?
> Wehen I put it in the same dir/package as my servlets
> (for instance /WEB-INF/classes/myApp ) it does not work!
>
> As I said it would not be possible to change a config file of the
> servlet runner (tomcat/resin) because the ISP of my webspace might be
> made excessive demands of with this ;-)
>
> Thanks a lot!
> Florian
>
> --
> To unsubscribe, e-mail:
<mailto:velocity-user-unsubscribe@xxxxxxxxxxxxxxxxxx>
> For additional commands, e-mail:
<mailto:velocity-user-help@xxxxxxxxxxxxxxxxxx>
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise