Craig said: ... > Sorry ... I was following an example from a published article (don't > remember where) so I presume that it (at least) *used* to be correct :-0.
yeah, it may have been right (or closer) once, but not since at least two years ago (when i started using velocity). > > ... > > > * Velocity advocates used to argue that using Velocity was safer > > > because it restricted what a page designer could do to calling > > > getter methods. This was never a completely true argument > > > (how do *you* know that the getter method of the beans you are > > > calling doesn't mutate something?), but it's been pretty much > > > eliminated by the fact that you can call arbitrary methods > > > in Velocity. > > > > yes, it is possible to design badly even in Velocity, but perhaps we could > > agree it's at least harder in Velocity to do so. > > Harder != Impossible. yep, that's what i said. we agree then! :) > > ... > > > > > > There was an interesting article on onjava.com about a project to > > > implement a simple blogger app that used both Struts and Velocity: > > > > > > http://www.onjava.com/pub/a/onjava/2002/04/17/wblogosj2ee.html > > > > > > I was particularly struck by the following snippet of Velocity code: > > > > > > $macros.showNavBar(true) > > > > > > which builds part of the UI by rendering the navigation bar. I don't know > > > about you, but that looks an awful lot like a scriptlet equivalent: > > > > > > <% macros.showNavBar(true); %> > > > > > > to me :-). > > > > yeah, no offense intended to David Johnson, but that's a really poor way to > > use Velocity. it looks as though that method is intended to spit out some > > HTML hardcoded into whatever $macros is or some such thing. the HTML > > shouldn't come from the java, it should be in the template to begin with, or > > at least defined the global Velocimacro library. that way the code could > > just be: > > > > #showNavBar( true) > > > > Fine ... still looks like a scriptlet to me :-). looks can be deceiving! with a proper velocimacro, the HTML isn't hard-coded into java classes. that may not be important to some folks, but it is to me. i think it goes a long way toward *encouraging* good MVC separation. it's not just a matter of syntax, but of design philosophy as well. ... > Actually, Ted's Struts book (Struts In Action) devotes an entire chapter > to using Velocity and Struts together, including how VelocityViewServlet > helps you out. It would make a pretty good starting point for people > interested in learning how to combine them. yeah, i haven't gotten to see it, but i heard he talked about the Velocity+Struts stuff in it. i'm hoping it gets more people looking into and/or using that code. i think there's some good potential there, but progress has kinda plateaued lately. it could use some fresh users/contributers to prod things along. Nathan Bubna [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>