You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ju...@sgcib.com on 2005/07/06 11:43:16 UTC

Loader problem

Hi

My problem should not be very difficult to solve but I do not manage to
find the solution by myself.

My project's directory is as follows:

root/lib/application.jar
root/config/templates/template.vm

I try to configure my code to have the templates searched in the good
directory by this :

Velocity.init();
Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH ,
"../config/templates");
VelocityContext context = new VelocityContext();
context.put("element",(Element)e.elementAt(i));

StringWriter w = new StringWriter();
FileWriter fw = new
FileWriter("../output/html/pages/"+((Element)e.elementAt(i)).getId()+".html");

System.out.println("Localisation="+Velocity.resourceExists("template.vm"));

Velocity.mergeTemplate("template.vm", context, fw );


but I get a resourcenotfoundexception when I try to get the template.vm
template on the last line.

If I paste the template in the directory root/lib and do not set the
property , it works but It's not what I want.
I saw a similar bug in bugzilla but it did not help...

And I did not find a sample code in the developer's guide, that's why I
post on the dev list.

Thanks for helping,

Julien




******************************************************************
This message and any attachments (the "message") are confidential and intended solely for the addressee(s). Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified.                         ***************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration.La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.
******************************************************************

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