Wouldn't it be more appropriate to pass in a map of parameters?
On Fri, Sep 12, 2008 at 9:04 AM, Christopher Schultz <
[EMAIL PROTECTED]> wrote:
> All,
>
> I was just reminded of the horror of the Struts 2 implementation of
> their tag library in Velocity. Mind you, I think the S2 guys did a
> /great/ job of creating implementations of their library in JSP,
> Freemarker, and Velocity, but the Velocity implementation just doesn't
> feel right.
>
> Here's what you see in JSP (and, do a large degree, Freemarker is nearly
> identical):
>
> <struts:someTag foo="bar" baz="whatever">
> ...
>
> In Velocity, since named macro parameters are not supported, you get
> something like this:
>
> #strutsSomeTag("foo=bar" "baz=whatever")
>
> (See http://struts.apache.org/2.0.11.2/docs/velocity-tags.html for
> reference).
>
> While that does get the job done, you can see that, for every evaluation
> of the macro, the S2 implementation has to re-parse the strings that are
> being passed-in in order to grab the parameter value and then assign it
> to the actual attribute on whatever object that represents the tag itself.
>
> Performance-wise, it's a hog. That means that Velocity starts with a
> built-in performance disadvantage when it comes to using S2. It's also
> visually cumbersome, since the attribute AND value are all within the
> quotes. Perhaps I'm being nit-picky, but I've considered abandoning
> Velocity for my next Struts project (which will be using S2). I would
> imagine that I'm not the only one who would come to this conclusion.
>
> So, my question is: can we do better? I wonder if there's a way to add
> something to the Velocity language that would give users a more
> tag-oriented syntax that would "feel" more like JSP/Fm and yield better
> performance.
>
> -chris
>
>
--
Forio Business Simulations
Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com