The Apache Velocity development team has released version 1.4 of the Velocity templating engine. Changes include: New (and better) introspection code, Pluggable introspection, and of course lots of little fixes.
- Posted by: Dion Almaer
- Posted on: April 19 2004 08:13 EDT
Read the Velocity 1.4 announcement
View the Change Log
Download the latest release
- Why would you use Velocity anyway? by Taras Zhugayevich on April 19 2004 11:57 EDT
- Why would you use Velocity anyway? by Paul Danckaert on April 19 2004 12:07 EDT
- because of its simplicity by Valeri Sarantchouk on April 19 2004 13:17 EDT
- Why would you use Velocity anyway? by Juozas Baliuka on April 19 2004 13:28 EDT
- no need for compilation by joachim peer on April 19 2004 13:41 EDT
- Why would you use Velocity anyway? by Rickard Oberg on April 19 2004 15:58 EDT
- Why would you use Velocity anyway? by Taras Zhugayevich on April 19 2004 16:14 EDT
- Why would you use Velocity anyway? by Maurizio Turatti on April 20 2004 09:57 EDT
No offence, but really why would you use Velocity if there JSP custom tags plus there is a JSP 2.0 on its way with expression language and other new features.
If I am not mistaken, long time ago there was an article in Java Developers Journal about benefits of Velocity and why it is better then JSP. Unfortunately, examples given there did not provide full answer on question: "Why is it better?".
Personally I don't use it for web rendering, but its been great for templated data generation. I use it to generate RSS feed data, mail message templates, specialized output files, and other sorts of things. Figuring out how to bind a few specialized helper objects into the Velocity Context is pretty easy, and makes it easy for getting templated data out.
I can see it would work fine for many people for a web interface, but with JSTL and EL, JSP works fine for my needs for basic rendering operations.
Thanks for reply.
JSP 2.0 is a complete departure from the original concept of JSP 1.0 of having full power of Java in the view layer. If you use JSP 2.0 main features - JSTL EL - then you are using JSP pages as view templates. Pure template engines (Velocity, WebMacro, FreeMarker, etc) are more suitable for this job because they were designed for this task (to serve view templates) from their inception. After years of simplifications and improvements JSP still is way more complex (in syntax, usage, config) and less performant than any template engine EL.
Since I switched from JSP to Velocity and never had any need to go back: the development is much easier, there is no temptation to misuse full power of Java in the wrong place, Velocity doesn't tie you to HTTP environment - it's quite possible to use it in a standalone app.
In terms of IDE support for Velocity there is a decent Eclipse plug-in and Dreamweaver extension. In terms of framework support, I would mention Spring, WebWork2, and Turbine they provide first class support for Velocity templates.
There is a number of alternatives for the view layer: XSLT, XMLC, Tapestry (which is using its own rendering engine). I think, the best approach is to find the right tool for the job.
The following are well-known references:
The Problems with JSP
Reactions to "The Problems with JSP"
I use more JSP than Velocity templates too, but not because I prefer JSP, it is more "old tradition".
It is faster to develop UI with velocity, I do not need to restart server or to recompile page to make some title bold or to find some NPE in generated code with hidden stack trace. Velocity saves a lot of time, but has limitations and needs some workarounds like "tools" to format output too.
since velocity does not need to be compiled, it can be served directly out of a database, for example. I figure that this might be very convenient for CMS developers.
=> No need to deal with temporary java/jsp files, etc. However, I assume that there must be some elegant solution to this problem for JSP, but currently I am not aware of any such work
I do not use it and I am not sure it is a good idea, but it is possible to reuse JSP code in templates too, looks like Freemarker interprets JSP tags.
In our CMS we use only Velocity, for several reasons: 1) No need to have files (=can store custom templates as strings in some config) 2) It's very fast 3) The scripting language is much more limited than JSP, hence is easier to teach to customers when they need to customize the standard templates.
There's a number of more reasons, but these are the primary ones for us.
Thank you very much everybody for valuable input.
Mostly because you can teach Velocity to any html developer in a couple of days. Can't say the same for JSP and even JSTL.