Please! Somebody helps me!
talkabout@mandic.com.br wrote:
>Hi.
>
>I have a question.
>
>I have a class that control the velocity in my app. This class has a method that return
>a Template. But, I want to load from its full pathname.
>
>Like that:
>public class VelocityControl
>{
> private static VelocityEngine velocity;
>
> static
> {
> velocity = new VelocityEngine();
>
> velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, "");
> velocity.setProperty(RuntimeConstants.PARSER_POOL_SIZE, "10");
> velocity.setProperty(RuntimeConstants.VM_MESSAGES_ON, "false");
>
> try
> {
> velocity.init();
> }
> catch (Exception e)
> {
> throw new ServiceError("Não foi possível inicializar o
>Velocity.", e);
> }
> }
>
> public static Template getTemplate(String name) throws ParseErrorException,
>ResourceNotFoundException, Exception
> {
> return velocity.getTemplate(name);
> }
>}
>
>So I made calls like:
>
>VelocityControl.getTemplate("c:\anything\template.vm");
>VelocityControl.getTemplate("/var/velocity/template.vm");
>VelocityControl.getTemplate(sc.getRealPath("/WEB-INF/velocity/template.vm");
>
>Thanks.
>José Luiz Junior
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
|