• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Velocity Vs JSTL

 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

thanks.
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

./pope
 
Author
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Rob
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic