You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Raghuram Thoram <rt...@comcast.net> on 2003/07/22 06:51:55 UTC

help needed regarding the use of velocity templates

Hi,
I have a question regarding the usage of velocity templates.
I downloaded the velocity and able to successfully run the examples. I made the necessary code changes to integrate velocity in our application and use it. I created the template files(.vm) in the local workspace of eclipse and able to use them. Instead of having the .vm file in my local system, I want to have it in another host. I used the file resource loader for referencing the .vm file located in a different host. Still, I am receiving the resourcenotfound exception. I am doing this as I am creating a jar file for my project and deploying it on a server. I run the project using webstart.

Thanks for the help in advance.
ram

Re: help needed regarding the use of velocity templates

Posted by Nathan Bubna <na...@esha.com>.
Raghuram Thoram said:
...
> Instead of having the .vm file in my local system, I want to have it in
another host.
> I used the file resource loader for referencing the .vm file located in a
different
> host. Still, I am receiving the resourcenotfound exception.
...

uh, the FileResourceLoader is not at all designed to work across a network.  i
think you may need to use something like this URLResourceLoader that Geir has
in the whiteboard section.

http://cvs.apache.org/viewcvs/jakarta-velocity/whiteboard/geir/URLResourceLoad
er.java

i haven't used it myself, but i know the standard resource loaders aren't
meant for loading remote files.

Nathan Bubna
nathan@esha.com


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


Re: help needed regarding the use of velocity templates

Posted by Nathan Bubna <na...@esha.com>.
A. Kevin Baynes said:
>
> You are correct, you must implement your own caching mechanism if you take
> this approach.
...
> | -----Original Message-----
> | From: Anthony Eden [mailto:aeden@signaturedomains.com]
...
> | Parsed templates will not be cached in this case, right?  That is the
> | downside to this approach, I believe, but someone correct me if I
> | am wrong.
...
> | A. Kevin Baynes wrote:
> |
> | >If you don't want to use a ResourceLoader, you can use the VelocityEngine
> | >directly. I locate my templates directly and feed them into
> | >VelocityEngine.evaluate().
...

of course, even if you cache your templates, you will pay the overhead of
reparsing the template each time as long as you are feeding them through
VelocityEngine.evaluate() or Velocity.evaluate().  if you write your own
ResourceLoader implementation, velocity should cache the parsed templates for
you.

Nathan Bubna
nathan@esha.com


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


RE: help needed regarding the use of velocity templates

Posted by "A. Kevin Baynes" <kb...@seagullsw.com>.
You are correct, you must implement your own caching mechanism if you take
this approach.

~akb

| -----Original Message-----
| From: Anthony Eden [mailto:aeden@signaturedomains.com]
| Sent: Wednesday, July 23, 2003 11:01 AM
| To: Velocity Users List
| Subject: Re: help needed regarding the use of velocity templates
|
|
| Parsed templates will not be cached in this case, right?  That is the
| downside to this approach, I believe, but someone correct me if I
| am wrong.
|
| Sincerely,
| Anthony Eden
|
| A. Kevin Baynes wrote:
|
| >If you don't want to use a ResourceLoader, you can use the VelocityEngine
| >directly. I locate my templates directly and feed them into
| >VelocityEngine.evaluate().
| >
| >~akb
| >
| >| -----Original Message-----
| >| From: Raghuram Thoram [mailto:rthoram@comcast.net]
| >| Sent: Tuesday, July 22, 2003 12:52 AM
| >| To: velocity-user@jakarta.apache.org
| >| Subject: help needed regarding the use of velocity templates
| >|
| >|
| >| Hi,
| >| I have a question regarding the usage of velocity templates.
| >| I downloaded the velocity and able to successfully run the examples. I
| >| made the necessary code changes to integrate velocity in our
| application
| >| and use it. I created the template files(.vm) in the local workspace of
| >| eclipse and able to use them. Instead of having the .vm file
| in my local
| >| system, I want to have it in another host. I used the file resource
| >| loader for referencing the .vm file located in a different host. Still,
| >| I am receiving the resourcenotfound exception. I am doing this as I am
| >| creating a jar file for my project and deploying it on a server. I run
| >| the project using webstart.
| >|
| >| Thanks for the help in advance.
| >| ram
| >|
| >
| >
| >---------------------------------------------------------------------
| >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


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


Re: help needed regarding the use of velocity templates

Posted by Anthony Eden <ae...@signaturedomains.com>.
Parsed templates will not be cached in this case, right?  That is the 
downside to this approach, I believe, but someone correct me if I am wrong.

Sincerely,
Anthony Eden

A. Kevin Baynes wrote:

>If you don't want to use a ResourceLoader, you can use the VelocityEngine
>directly. I locate my templates directly and feed them into
>VelocityEngine.evaluate().
>
>~akb
>
>| -----Original Message-----
>| From: Raghuram Thoram [mailto:rthoram@comcast.net]
>| Sent: Tuesday, July 22, 2003 12:52 AM
>| To: velocity-user@jakarta.apache.org
>| Subject: help needed regarding the use of velocity templates
>|
>|
>| Hi,
>| I have a question regarding the usage of velocity templates.
>| I downloaded the velocity and able to successfully run the examples. I
>| made the necessary code changes to integrate velocity in our application
>| and use it. I created the template files(.vm) in the local workspace of
>| eclipse and able to use them. Instead of having the .vm file in my local
>| system, I want to have it in another host. I used the file resource
>| loader for referencing the .vm file located in a different host. Still,
>| I am receiving the resourcenotfound exception. I am doing this as I am
>| creating a jar file for my project and deploying it on a server. I run
>| the project using webstart.
>|
>| Thanks for the help in advance.
>| ram
>|
>
>
>---------------------------------------------------------------------
>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


RE: help needed regarding the use of velocity templates

Posted by "A. Kevin Baynes" <kb...@seagullsw.com>.
If you don't want to use a ResourceLoader, you can use the VelocityEngine
directly. I locate my templates directly and feed them into
VelocityEngine.evaluate().

~akb

| -----Original Message-----
| From: Raghuram Thoram [mailto:rthoram@comcast.net]
| Sent: Tuesday, July 22, 2003 12:52 AM
| To: velocity-user@jakarta.apache.org
| Subject: help needed regarding the use of velocity templates
|
|
| Hi,
| I have a question regarding the usage of velocity templates.
| I downloaded the velocity and able to successfully run the examples. I
| made the necessary code changes to integrate velocity in our application
| and use it. I created the template files(.vm) in the local workspace of
| eclipse and able to use them. Instead of having the .vm file in my local
| system, I want to have it in another host. I used the file resource
| loader for referencing the .vm file located in a different host. Still,
| I am receiving the resourcenotfound exception. I am doing this as I am
| creating a jar file for my project and deploying it on a server. I run
| the project using webstart.
|
| Thanks for the help in advance.
| ram
|


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