David Rees wrote:
>
> Hi Geir and gang,
>
> I compiled the Velocity taglib the other night, and had a chance to give it
> a quick whirl this morning.
Excellent!
>
> My initial impressions are good, my only complaint was that I had to build
> it and an unfamiliarity with tag libraries.
Come on. :) Because of JJAR, the only thing you had to do was download
from CVS, have ant installed, and type
$ ant getjars
$ ant jar
and done.
I am not that familiar with taglibs either :)
>
> I wrote a couple simple pages, one in JSP, one using JSP/Velocity and
> performance was pretty good, maybe a 30% performance hit.
Really? I am surprised that JSP is that much slower :)
Seriously, what JSP engine? Velocity, with a decent data-access page, I
believe will easily keep up with JSP.
> So are my questions:
>
> How does the taglib work?
Very simply - it treats everying in between the start and end tags as
VTL and parses and renders it into the output stream.
> How does velocity get invoked to parse the code?
The taglib uses the standard taglib callback architecture - nothing
special or magical.
> Where is the velocity engine hiding?
In the normal place - the velocity.jar that is hopefully not in your
classpath, but in WEB-INF/lib
> I know you mention velocimacros as a
> benefit to using the taglib, is there an equivalent to the VM_globals.vm or
> do you just have to include a global file which has your macros defined
> there?
(You really can't include VMs.)
Yes, a global library (or plural...) will indeed work if you use the
singleton model for Velocity (which the taglibs does). What you could
do is make a little startup servlet (use <load-on-startup>) that
configures Velocity with the template path to find the global library
for your webapp.
I will try to document how to do that this week.
geir
> Thanks,
> Dave
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb