I'm using the latest as of yesterday, though I can only get it to run on Tomcat (normally I run on OC4J but it's having some odd problems with the latest release).
I'm not using the ww tags, so I don't know if this would break anything there, but I can see how it would break existing velocity apps. Is the velocity tag support new enough that it can be changed to what I suggested, and have everyone accommodate that update, or do we need to deal with compatibility? If we have to worry about that, perhaps a "valueparam" directive that works as I described would do the trick. Personally, I think that's overkill since these are features that haven't even gone into a final release yet, and I would find having a "param" and "valueparam" or other compatibility kludge confusing as a new ww user. Of course, that's presuming that my suggestion isn't breaking or violating something more subtle that I can't see. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Cannon-Brookes Sent: Tuesday, November 11, 2003 10:56 PM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] More about velocity directives Drew, We've just been playing with this today and I have to say I agree that this makes things much neater - good idea! It would break existing Velocity uses though. Are you using the latest WW2 CVS with Velocity? (We're having problems upgrading to it) Cheers, Mike On 12/11/03 5:24 PM, "Drew McAuliffe" ([EMAIL PROTECTED]) penned the words: > I couldn't find my previous email on the SF list yet to keep this > reply there, but I believe I understand now why the velocity > directives act the way they do. In my post, I indicated that it would > be easier to pass objects from the velocity context into bodytag > params if you could do so without popping things onto the stack. For > example, where this works now, > > #foreach ($item in $myItems) > $stack.push($item) > #bodytag(Component template="mytemplate.vm") #param("param1" "$item") > #end #set ($item = $stack.pop()) #end , the following would be > preferable: > > #foreach ($item in $myItems) > #bodytag(Component template="mytemplate.vm") #param("param1" $item) > #end #end > > The difference is that in the second example, the reference to $item > isn't quoted, and the value is passed into the velocity context for > evaluation. I now understand why this doesn't work like that. In the > ParamDirective.render method, the "value" portion is evaluated against the valueStack: > > if (stack != null) { > value = stack.findValue(value.toString()); > } > > So, even if you pass in just $item, without quotes, it will be > converted to a string and its string contents evaluated against the > value stack, then passed to the velocity context for rendering. > > I would suggest removing these lines in order to simplify the use of > the #bodytag directive. By doing so, the simpler, more > velocity-intuitive syntax I've shown would work. If you truly wanted > to evaluate something against the valueStack, you could manually as follows: > #foreach ($item in $myItems) > #bodytag(Component template="mytemplate.vm") #param("param1" > $stack.findValue($item)) #end #end > > Now, I'm not sure if this would break anything else, or if there is a > better way to do this, or even if it would work (I'm checking on that > now), but I thought I'd throw some more info out there. > > Thanks, > > Drew > > > > ------------------------------------------------------- > This SF.Net email sponsored by: ApacheCon 2003, > 16-19 November in Las Vegas. Learn firsthand the latest developments > in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! > http://www.apachecon.com/ > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork