On 11/24/01 5:02 PM, "Donnie Hale" <[EMAIL PROTECTED]> wrote:

> I'm throwing this question out there now as I'm playing around with the
> Struts-Velocity integration. One person responded that they'd like to see a
> Struts html:form-like macro library in Velocity. I think that would be
> useful as well, especially if we want Struts/Velocity to have some of the
> Struts/JSP capabilities, such as auto-populating of forms based on the
> current values of an ActionForm in the request/session context.

Cool beans.  I was talking to a Velocity user at a client the other day, and
he said that it would be nice to have little HTML-generating Velocimacros,
so while your doing the form one... :)


> 
> As it stands right now, parameters to Velocity macros are position-based.
> The docs say that the same number of args must be passed as are specified in
> the macro definition. Unfortunately, that makes it difficult to directly
> mimic, for example, a Struts <html:form ... > tag. Typically, only a couple
> of parameters are passed. However, there are a bunch of parameters that can
> be passed. In the case of Struts, the parameters are name-value pairs.
> 
> While there are some less-than-perfect ways to work around this or to
> slightly enhance the position-based macros, the best solution (I think)
> would be to develop a name-value macro capability. Would that violate any
> fundamental philosophical tenet of Velocity? Would it make more sense to
> make it a separate directive, e.g. #nvmacro (lousy name, I know), or to
> extend the current #macro directive to work either way?

Hm.  Like what do you imagine to do?

I can see some workarounds, such as :

#foo( [$a, $b, $c] [$x,$y, $z] )

Or populating a map and passing that in...

#set($foo.name = $value)
#set($foo.anothername = $anothervalue )


-- 
Geir Magnusson Jr.                                     [EMAIL PROTECTED]
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


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

Reply via email to