Discussions

News: Apache Velocity 1.4 Released

  1. Apache Velocity 1.4 Released (10 messages)

    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.

    Read the Velocity 1.4 announcement

    View the Change Log

    Download the latest release

    Threaded Messages (10)

  2. Greetings,

    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?".

    Best regards,

    Taras
  3. 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.
  4. Good point.

    Thanks for reply.

    Taras
  5. 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:
    YMTD
    The Problems with JSP
    Reactions to "The Problems with JSP"
  6. 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.
  7. no need for compilation[ Go to top ]

    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

    Joe
  8. no need for compilation[ Go to top ]

    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.
  9. 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.

    YMMV.
  10. Thank you very much everybody for valuable input.

    Regards,

    Taras
  11. 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.