Slashdot Mirror


Jakarta Velocity Tools 1.0 Released

Nathan Bubna writes "Jakarta Velocity Tools is a newly released project from the Apache Software Foundation. It provides servlets and tools for rapid, clean, MVC web development with Velocity, tools for using Velocity with the Jakarta Struts framework, and a set of generic tools to help with any Velocity project."

28 comments

  1. Anyone use Velocity? by Dr.+Bent · · Score: 1

    I'm considering building a WebApp using JBoss + Tomcat + MySQL. However I'm still undecided on how to develop the frontend...I'm thinking JSP + something. Has anyone had any success with Velocity in a real-world product?

    1. Re:Anyone use Velocity? by thelexx · · Score: 1

      Absolutely. I work in auto finance and built a web credit app entry piece for our dealers using Velocity. Senior mgmt had balked at the idea for almost two years before I got the go ahead to do it. Within four months it was taking in almost half of our total business and was accounting for upwards of 60% of approved deals. Not bad for a ~100k of code (there are some reports online too) and about thirty templates...

      --
      "Gold still represents the ultimate form of payment in the world." - Alan Greenspan, 1999
    2. Re:Anyone use Velocity? by ryarger · · Score: 4, Interesting

      Yes, I use Velocity as the central tempating engine for our in-house application server. What I really like about Velocity is that it forces seperation of presentation from code by completely disallowing arbitrary code inside of the template. You can still do everything you need to do with helper classes, which promotes great reusability and clean code.

      In my opinion Velocity is the best Java-based templating system and the second-best over all (next to Zope's near perfect PageTemplates system).

    3. Re:Anyone use Velocity? by camelcai · · Score: 1

      Yes. I love it. We used it for a on-line casino content management system. Basically I rewrote all the old JSPs the JSPs only compute values then invoking the Velocity templates for presentation. Good thing is I stored all the Velocity templates in a database with versioning. So the casino can have a live content release with an development release independently evolving. See Lokitech for details.

      --
      jpenguin AT the google email service
    4. Re:Anyone use Velocity? by JediTrainer · · Score: 4, Informative

      Absolutely!

      I'm leading a team of developers using Velocity for a large e-Business application, with many modules. It's a beauty to use, and our solution has won a few awards last year. We use a custom framework (not Struts, not VelocityServlet) to choose templates to load, since our app is designed to be highly customizable for each of our customers (medium or large business, including government). We also keep the locale in the session, and load the appropriate localized Velocity template if available. Let's just say this app is quite large. We now have well over a thousand Velocity templates, built up over the last few years.

      Unfortunately I'm not at liberty to identify the application or the company here, because the company is actually very much a Microsoft shop, and it's been a major political issue that I've had our team move our application away from Microsoft solutions (it used to be VB/ASP). But it's performed well and never let us down (although the 1.3 release of Velocity was quite buggy and we had to revert to 1.2 until 1.3.1 came out).

      I would wholeheartedly recommend Velocity. I had our team start using it because we ran into a huge mess with ASP (which I knew would repeat with JSP). Enforcing code separation between your view and your model is important, and Velocity does it beautifully. It avoids having a lot of unnecessary (and unmaintainable) cruft mixed in with your HTML.

      If you need more specific information, we can discuss it by email. I'll be happy to help you in any way that I can.

      --

      You can accomplish anything you set your mind to. The impossible just takes a little longer.
    5. Re:Anyone use Velocity? by Anonymous Coward · · Score: 0

      i'll get modded to an oblivion for this but using VB.NET theres 100% logic/presentation seperation, and you will get a performance boost.

      Sun did the Petstore example with J2ee, MS ported it to .NET and showed a huge performance spike... that was a year ago and I have not heard any response from the Sun group...

    6. Re:Anyone use Velocity? by Cynicx · · Score: 1

      Weave it with Tapestry:

      http://jakarta.apache.org/tapestry

    7. Re:Anyone use Velocity? by ewg · · Score: 1

      Velocity is the preferred templating system in the Jakarta Turbine framework. I've used it in a web application I been developing and supporting over the past two years.

      Velocity is very comfortable. I find it cleaner than JSP. Its limitations tend to push logic back into the Java code where it belongs. You write a 'pull tool' to expose an API to the Velocity layer and then have a lot of freedom to design and redesign your interface.

      --
      org.slashdot.post.SignatureNotFoundException: ewg
    8. Re:Anyone use Velocity? by ewg · · Score: 1

      Replying to my own post--

      One *huge* advantage of Velocity is that you can use it to generate documents other than web pages. I use it to create utility emails and in one case an XSL-FO document for PDF generation. I can leverage my web page velocity skills to these other realms.

      Not sure how you would do that in JSP or ASP!

      --
      org.slashdot.post.SignatureNotFoundException: ewg
    9. Re:Anyone use Velocity? by Dr.+Bent · · Score: 2, Insightful

      Sun did the Petstore example with J2ee, MS ported it to .NET and showed a huge performance spike... The reason for the performance "boost" was that Microsoft didn't use EJB data caching in the Java version they tested against. So every request sent a query straight to the database. They did use a database caching system for thier implementation, however, and so the performance was much higher. Certianly not apples and oranges, but what do you expect from Microsoft.

    10. Re:Anyone use Velocity? by Dr.+Bent · · Score: 1

      If you need more specific information, we can discuss it by email.

      I'd love more specific information...but what's your e-mail address? (it's not public)

    11. Re:Anyone use Velocity? by mainguym · · Score: 1
      Not for a web front end, but for a generic templating solution. In addition, I noticed the other day that Posiden by Gentleware http://www.gentleware.com/ uses velocity. I really like it because (as others have mentioned) you really can't do any programming with it (unless you really torture it). It allows a really clean separation of the display from the logic.

      I don't understand the people who say it's difficult to use, from the template perspective all you do is put a dollar sign ($) and a bean name with a dot and then the field name (minus the get)... I.E. if your bean looks like this... public class foo { public String getBar() } then in your template to display the string returned by bar you'd just put $foo.bar that's it, no or nonsense. There are a few conditionals #if #else...and a #foreach construct as well as the ability to set values also, but, the greatest thing about it is it's simplicity. Well, that's my twenty cents.

    12. Re:Anyone use Velocity? by JediTrainer · · Score: 1

      email me:

      arozeluk [at thingy] websoup [period] net

      --

      You can accomplish anything you set your mind to. The impossible just takes a little longer.
    13. Re:Anyone use Velocity? by dmacon · · Score: 1

      The casino appears to be using PHP. Is your system removed, not yet deployed or offline generation?

      cheers.

      --
      -- Tov Are Jacobsen
  2. Re:Wow by loveaxelrod · · Score: 0, Troll

    Keep going!! Given todays news and extrapolating I think if you masturbate MORE than five times a day (the recommend allowance) you will cure all your ailments.

    I was told this by a travelling salesman - I looked like a sensible man he said!, then he was gone - with 40 of my dollars. But I, I had the information....

  3. FreeMarker by Lordrashmi · · Score: 2, Insightful

    I messed with Velocity but found it to be somewhat of a pain in the butt. I much prefer FreeMarker. Similar features to Velocity, just easier to use. Oh and the documentation kicks ass, which is one area I found lacking in velocity.

    And no, I am not a freemarker developer, just a happy user.

    1. Re:FreeMarker by dmacon · · Score: 1

      Freemarker is great. It is reasonably powerfull and at the same time eliminates stabliity threatning features available in JSP.

      Cheers,

      --
      -- Tov Are Jacobsen
  4. Velocity vs. JSTL and/or Custom Tags by one9nine · · Score: 2, Interesting
    I've looked through some of the docs on Jakarta but I don't see much of a differece between JSTL and Velocity except I feel that JSTL is much more cleaner. I was wondering if someone has had expereince with both and can explain the ups and downs of each.

    If you haven't used JSTL I strongly suggest that you give them a look as well. Very simple to use, very extensive and really make JSP alot faster to develop and maintain.

    1. Re:Velocity vs. JSTL and/or Custom Tags by KillerLoop · · Score: 2, Informative

      I've used both and the conclusion is (at least for me) that I like JSTL (and Taglibs in general) more.

      While Velocity provides for a clean separation of logic and presentation, so do taglibs with the added benefit that they are *much* easier on the webdesigner, and there is tool support to render them during design phase. Besides that, there *has* to be logic in the presentation, namely presentation logic. The backend gives a damn how a number has to be formatted, or from which resources actual pieces of text come. Taglibs provide a rich set of features to accomplish this. I'm also very fond of available third-party taglibs with a clean mechanism for using and incorporating them.

      Of course this can be done with velocity too in the form of helper beans, but I find the tag approach much easier and cleaner.

      I don't need a tool that forces separation upon me, I do it out of my own accord. Everything possible with Velocity can be done in Taglibs, and I believe with the backing JSP receives it's the more future oriented approach. Chances are that you are able to hire guns proficient in Taglibs and JSP, at least more so than Velocity... if only for the vast amount of resources like books and tutorials on offer for JSP.

      My bet is on JSTL and Tablibs, altough I've used templating systems (Webmacro, Freemarker, Velocity, HTML::Template...) extensively and grew quite fond of them.

  5. VTL should be called by butane_bob2003 · · Score: 1

    Yet Another Template Language. Or is there a YATL out there already? VTL at a glance does not look very intuative or powerful (at a glance). If I am going to have code mixed with html, might as well make it Java, cause thats what the back end is. I'll stop trolling now, it's probably OK once you get used to it. (but so is hypothermia) Ok, now I'll stop trolling.

    --


    TallGreen CMS hosting
  6. Re:Java sucks donkey balls by Anonymous Coward · · Score: 0
    Java sucks donkey balls. Use a real programming language, fools.

    Hey, don't knock donkey balls!

  7. 100% logic/presentation separation: never true by brlewis · · Score: 1
    i'll get modded to an oblivion for this but
    I have moderator points and could have modded you down, but I'd rather reply.
    using VB.NET theres 100% logic/presentation seperation
    This, as always, is untrue. There is no such thing as 100% logic/presentation separation. Suppose you have a wide table that is the result of a database query. Should you make every third row a different background color to ease horizontal navigation? Every other row? Just leave them all the same background color? This decision is both a presentation decision and a logic decision. How many decimal places should you show for this particular number? There's another decision where logic and presentation are intertwined. Clearly both the model matters (How many decimal places are necessary for the entity to have meaning?) and the view matters (How much horizontal space do I have on this report?) I could go on and on with examples where you cannot separate the logic from the presentation.

    You can partially separate logic and presentation. How much separation is appropriate depends on the project...actually on individual instances within the project of logic/presentation relationships.

    There are lots of people out there who do too little separation of presentation and logic. They'll end up with a better end result if they use Velocity, Freemarker or webmacro. There may also be people out there who produce overly bland user interfaces because they try too hard to separate presentation and logic. They would benefit from JSP, BRL, Tea, PHP, CF, or somesuch. Although with BRL it's easier to extricate the logic from the presentation if you start out with too little separation.

    OK, enough ranting. It's just that this "100% separation" fiction is one of my pet peeves.

  8. emails, PDFs by brlewis · · Score: 1

    You can use BRL that way. See the testsuite directory in the source distribution for how to process BRL files without any web framework. Additionally, there's a builtin function for LaTeX-escaping strings, in case you want really nicely formatted PDF reports, as I do. Additionally, when you embed code to generate an email within a file that generates a web page, the same nice template syntax is used as at the top level, unlike any similar technology that I'm aware of.

  9. Presentation and Code by atani · · Score: 2, Interesting

    Since people are talking here about the separation of presentation and logic code, I'd simply like to throw in another toolkit which achieves this wonderfully: Janx (demo here).

    While total separation is not the goal, the fact that after only a couple of hours of me explaining the basics of flow control and context to purely HTML/Interface folks they were able to take full control of the user interface development and maintenance of an active online magazine.

    Mod me as a troll if you will, but I've yet to find a toolset as simple as Janx (powerful too, though it does need some updating).

  10. Velocity is nice by Arkham · · Score: 1

    I've used jsp, WebMacro, jsp+struts, and a few other other presentation layers. I really like Velocity because it enforces the separation between the controller and the view (unlike jsp-based templating languages, which often get abused to include business logic by poor programmers who don't know what they should be doing). Since you have to explicitly put something in the velocity context via the controller, the view can only display what has been put in its context.

    The other advantage of velocity is its very simple scripting language. It's a lot easier than some of the tag-based templating tools I have seen. For a developer, it's not a big selling point, but if you're working with a designer, it can make a big difference.

    --
    - Vincit qui patitur.
  11. Re:Java sucks donkey balls by Anonymous Coward · · Score: 0

    I'd love to hear what you'd suggest. You sound like you know what you're talking about.