I just wanted to add that, as a programmer, I find it easier to
maintain Velocity templates than JSP pages.  Like orders of magnitude
easier (of course, that was in the bad old days of JSP).  I started
programming web applications in JSP and switched happily to Velocity.
Many times, I've made radical changes to the underlying application
program without ever needing to touch the Velocity templates.

The #foreach directive serves most needs for a loop, and the Velocity
Tools project has some other useful tools for handling lists.  Mostly,
I just try to pass objects to the Velocity context that have precisely
what I would want to list.  Another alternative is to provide a public
method to the context that will screen a larger list to a smaller list
for the #foreach directive.

Barbara Baughman
X2157

On Wed, 11 Jan 2006, Paul Gillen wrote:

> Thanks for the prompt response Will.  My suspicion was that the need for
> Velocity was largely historical; you have, to some extent, confirmed that
> with the "JSP 2.0 is much improved" comment.
>
> In re the "functionally deficient, no for; try #foreach" discussion, we do
> use #foreach.  I'm looking at converting a JSP view to Velocity.  I have a
> LinkedList of product info I want to page through.  With JSP its:
>      for (idx=firstOnPage; idx<=lastOnPage; idx++)
> With Velocity I either have to create a new LinkedList containing only the
> products I wish to display at this time with a #foreach or I #foreach/spin
> through the entire LinkedList with a counter, stopping to process the first
> though last, and then continuing to spin.
>
> Your other comments are well taken but largely inapplicable here; after all,
> I'm not "less technical", I'm a guru  B<)  The 'email template' comment is
> interesting though; more research required on my part.
>
> Thanks again
> =Paul=
>
> On 1/11/06, Will Glass-Husain <[EMAIL PROTECTED]> wrote:
> >
> > Hi Paul,
> >
> > I develop apps that use either Velocity or JSP / JSTL on a regular basis.
> > Both are good tools.
> >
> > To keep things short, user feedback on Velocity is
> > * Velocity has a simpler syntax and is often easier to use for less
> > technical users.
> > * Highly customizable (I run a site that has a domain-specific page markup
> > language used by hundreds of users)
> > * Can be used for web pages, email templates, code generation (not just
> > web
> > pages like JSP).
> >
> > I used to complain about JSP all the time (unreadable spaghetti scripts,
> > long-winded syntax, complex tag API) but JSP 2.0 is much improved.  I like
> > the large user base and the IDE support.  The latter exists for Velocity
> > but
> > is not as featured.
> >
> > There's more on this at this link.
> > http://jakarta.apache.org/velocity/overview.html
> >
> > Re: the "functionally deficient" comment.  Basically, Velocity focuses on
> > "Presentation" instead of "Scripting".  The idea is that you include
> > markup
> > in pages rather than a spaghetti code of scripts.  (which can quickly
> > become
> > unmaintainable in a large site).  This is a different philosophy than PHP
> > or
> > old-style JSP.
> >
> > And there is indeed a #foreach in Velocity.  If you'd like ideas about
> > using
> > that, I suggest you open a new thread.
> >
> > Cheers,
> >
> > WILL
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Paul Gillen" <[EMAIL PROTECTED]>
> > To: <velocity-user@jakarta.apache.org>
> > Sent: Wednesday, January 11, 2006 12:12 PM
> > Subject: Rationale for Velocity?
> >
> >
> > My new employer uses Velocity for page display technology.  In answer
> > to the question "why?" I get "its our standard".  True, but
> > intellectually unsatisfying.  Everything else is written in Java/JSP
> > which is in itself a powerful and functionally rich page display
> > technology.  Velocity on the other hand appears to be functionally
> > deficient, i.e. the absence of a "for" loop.  Even were this not true,
> > why change technologies when we get down to the view layer?  Why take
> > things out of a "session" construct only to put them in a "context"
> > construct for the convenience of Velocity when were we sticking with
> > JSP this step would be unnecessary?  Not trying to piss on anybody's
> > foot.  Looks like lots of folks use it. Looks like I'm stuck with it.
> > But I'm still looking for an answer to the question, "Why?"
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> ---------------------
> Paul D. Gillen
>

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

Reply via email to