The pushes and pops were necessary before recent changes made it possible to
pass in objects directly to the velocity directive. Also, there is now talk
about having two separate tags, one that does a "stack.findValue"
automatically and one that doesn't. Your second example shows that
parameters passed in as attributes of the tag or bodytag directive will be
evaluated against the stack, and that those passed in via param directives
won't. That's interesting, but I don't know that it's 100% intuitive or
self-evident.

I'm only recently aware of your second example, and your third example is
the first I've heard of that technique. It sounds like there's something for
everybody. It would be great if the section on the wiki on using the tags in
velocity were updated to show the various ways in which the directives can
be used.

So now I'm confused. What's the official next step on this? Are we going to
-come up with two separate param directives?
-go the way Matt's second example went, evaluating params against the stack
if they are part of the tag or bodytag directive, and not if they are part
of a param directive? (from what I understand, this is what's in CVS right
now).
OR something else?



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt
Ho
Sent: Tuesday, November 18, 2003 1:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Param directive

Hani Suleiman wrote:

> +1, the valuestack is a neat thing and all that, but having random
> pushs/pops happen in UI tags of all things just feels wrong.

Agreed.  However, I'm unclear why pushes and pops are required though.

#foreach( $number in $person.phoneNumbers )
     $stack.push($number)
     #bodytag(Component "template=numberDisplay.vm")
         #param("phoneNumber" "top")
     #end
     #set ($trash = $stack.pop())
#end

Why wouldn't you just write:

#foreach( $number in $person.phoneNumbers )
     #bodytag( Component "template=numberDisplay.vm" )
         #param( phoneNumber $number )
     #end
#end

Or what I'd be more inclined to write:

#foreach( $number in $person.phoneNumbers )
   #tag( Component "template=numberDisplay.vm" 
"params.phoneNumber=person.phoneNumbers[$velocityCount]" )
#end

Although I do admit the latter is less intuitive than the former.


M





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to