This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Velocity Vs JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Velocity Vs JSTL" Watch "Velocity Vs JSTL" New topic

Velocity Vs JSTL

Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Hello Rob,

I have read about velocity (javaranch actually had a nice article on that sometime back) and JSTL. As far as web development is concerned, with the advent of JSTL, does velocity still make sense?

Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
I am not quite sure if it is recommended or not its usage in a web context. But I feel that for some tasks it would be more easy to use VTL instead of JSTL or developing custom tags.


blog -
Rob Harrop
Ranch Hand

Joined: Nov 03, 2004
Posts: 44
Choosing between JSTL and Velocity really depends on the needs of your project. Certainly, you will find that out of the box JSTL provides many useful features that are not present in a vanilla Velocity install and many developers are already comfortable with with JSP tag syntax.

On the flip side of this, Velocity is much better in a multi-disciplined environment because its syntax is easier for non-developers to understand. Extending Velocity is really simple when using macros, which are all written in VTL, making it easy for designers to build reusable components as well as developers. For more power when building extensions you can build your own directives (a command that starts with a #) using Java. This mechanism gives you direct access to the underlying syntax tree built by the parser. Both of these approaches are covered in the book.

Since the book was written, a collection of useful Velocity macros has been added to Spring simplifying the creation of HTML forms and Velocity supoprt has been greatly extended in the framework.

You will also find that Velocity performs much better than the equivalent JSP code. I didn't quantify this in the book, but Rod Johnson does in his Expert One-on-One J2EE book - Velocity is twice as fast as JSP.

Of course, Velocity has many uses outside of the web, a topic which is covered extensively in my book. We use Velocity for generating mail from systems, for generating code as part of a generation framework, for generating CSV output plus a string of other uses.

Once you have tried Velocity and experienced the ease with which you can build web apps, I doubt you'll go back to JSP and JSTL.

subject: Velocity Vs JSTL