>> I'm working on a servlets-based project that uses Velocity and I'm trying
>> to upgrade from version 1.6.2 to 1.7.  Unfortunately, I can't figure out
>> how to make the "userdirective" property work the way it did in 1.6.2.

weird.  i don't remember anything changing with that property.  will
you consider filing a bug report for someone to look into this?

>> The servlets are all based on VelocityViewServlet and the directives are
>> all "LINE" type (modeled very closely on the examples in the wiki).  My
>> velocity.properties file contains the line:
>>        userdirective = com.whatever.FooDirective,com.whatever.BarDirective
>> I've put debugging statements in the directives so I can see that the
>> getName() function is being called once on startup.  After that, nothing.
>>  When my pages render, I see the "#foo($something)" code, not the rendered
>> output.  getType() and render() are never called at all.
>>
>> I found one way around this -- at the top of my servlet's doRequest()
>> function I can put a call like this:
>>
>>  getVelocityView().getVelocityEngine().loadDirective("com.whatever.FooDirective");
>> But using that call a dozen times for every page load seems like it will
>> affect my site's performance.

don't do it per request.  directives need only be loaded per instance
of VelocityEngine.  do it once at the end of servlet init.

>> This worked fine in 1.6.2; what am I doing wrong?

without a failing example to test, i don't really know.

>> -- Sam Clippinger
>>
>>
>>
>>
>>
>
>
> --
> Best Regards,
> Moatz Shawki

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

Reply via email to