opensubscriber
   Find in this group all groups
 
Unknown more information…

u : user@velocity.apache.org 14 December 2006 • 6:35PM -0500

Re: VelocityViewServlet & ClasspathResourceLoader ?
by Claude Brisson

REPLY TO AUTHOR
 
REPLY TO GROUP




Le jeudi 14 décembre 2006 à 21:17 +1100, David Elliot a écrit :
> Hi Claude,
>
> Thank you very much, using template = super.getTemplate("x.vm")  fixes
> the problem (my custom resource loaders from velocity.properties work
> for the VVS... hurrah!).

Without Nathan's questions this wouldn't have come out... :-)

> Can you point me towards some documentation regarding why:
>
>  template = Velocity.getTemplate("x.vm");
>
> Is bad ??    It's a nasty trap for the newbies!!!
>

When you make the static call Velocity.getTemplate(), you are using the
singleton model. When several instances of Velocity cannot share the
same configuration (for instance if they use different loaders), this
singleton model becomes unusable. That's why the good pratice is to keep
references on VelocityEngines rather than to initialize the static
Velocity object.

This is all explained here :

http://jakarta.apache.org/velocity/docs/developer-guide.html#To%20Singleton%20Or%20Not%20To%20Singleton...


  Claude

>
> On 12/14/06, Claude Brisson <claude@rene...> wrote:
> > That's probably the reason...
> >
> > template = super.getTemplate("x.vm") should be appropriate.
> >
> >   Claude
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velo...
> For additional commands, e-mail: user-help@velo...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velo...
For additional commands, e-mail: user-help@velo...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.