Ah - finally I understand.

The underlying issue is not Velocity 1.4 vs. 1.5.  It's the last release of
Velocity Tools (which used the Velocity singleton approach) vs. the latest
unreleased VelocityTools (which uses the Velocity Engine approach).

The NPE was a big red herring.  (though still something that should be
fixed).

In the past, your email routine shared a configuration by default with the
singleton.  Now the new approach to VVS requires you to either (A)
initialize a totally different Velocity engine or (B) share the engine as
you did.

note to Velocity Tools documenters - you might want to take note and add a
FAQ when this is released.  ("Q: why doesn't my non-web use of Velocity no
longer work.  A: because it's no longer sharing a configuration with VVS").

WILL

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: "Velocity Users List" <[email protected]>
Sent: Friday, April 15, 2005 4:07 PM
Subject: Re: Problem with decimal in most recent snapshot




Success!!! Ok kinda!!!

I got it to work, but I think it is very cheesy how.  I used your
extension method because I could not get the other ways to work.  To get
those other ways to work I believe you have to have the ServletContext.
To get that you have to pretty much be a Velocity Tool as far as I can
tell.  I think this is how Tiles is doing it.

So, cough, I made the extended VVS below call my email routine to give it
the VelocityEngine.   This is a bad solution in terms of my views on
development practices, but it works.

I think a good enhancement would be to allow developers to have a hook
into Tools loaded to do things like be able to get the VelocityEngine or
contexts.  I know this allows people to likely cause themselves problems
as well, but in general if they are doing it they likely have a reason.

I think what I am trying to do is a very potentially common reason that
was much easier for me to do in 1.4.  Web Templates and Email Templates
both working off a relative path to webapp.

Anyways you guys rock and all 70 or so templates in production appreciate
your work.  I am so all over the place trying to understand like 20 types
of technology that it is hard to have the depth that you guys do in this
as well.

Regards,


JohnE


Here is how I got the engine:


public class VelocityViewServletExtended extends VelocityViewServlet {

   public void init(ServletConfig config) throws ServletException
   {
       super.init(config);


TemplateToStringManagerBD.setVelocityEngine(this.getVelocityEngine()); }

}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to