FreeMarker 2.0 Page Templating Tool Available

Discussions

News: FreeMarker 2.0 Page Templating Tool Available

  1. It is my pleasure to announce the first production/stable release of FreeMarker 2 (codenamed Lazarus.) FreeMarker is a tried and true tool for doing page templates in Java. In practice, it is most often used in the web space to get data from servlets into HTML pages. The design goal is a clean separation of the details of presentation from the underlying application logic.

    FreeMarker 2 introduces, among other new features, full numerical support -- support for integer and floating point variables of unlimited precision. The core of the parser/compiler was rewritten using JavaCC, so for the first time, the FreeMarker template language has a formal grammar.

    Check out http://freemarker.sourceforge.net/
  2. What can I say...

    http://jakarta.apache.org/velocity/index.html


  3. What are you saying, then? -That Velocity is better than Freemarker? Worse? Anyway, it would be nice if somebody could share their experience with these two, and _substantiate_ it.

    Aslak
  4. Having done a lot of programming using Microsoft ASP I can only say that anything that replaces this kind of model is a good thing. JSP is basically exactly the same as ASP and suffers from all the same flaws. It's not that they are intrinsically evil it's just that the combination of a pwerful programming language (Java,VB etc) and HTML in the same file leads to long , cryptic , unmaintainable pages.

    It provides far too seductive a temptation to the unwary (unskilled?) programmer. We are all prey to this weakness,
    how many times are scruffy prototypes left in the final project?

    Personally I use WebMacro because it was the first templating language that I came across but having looked at Velocity and Freemarker I'd say that the choice is pretty much up to the user. These are only templating languages not web frameworks. The really good point about them is that
    they enforce a disciplined structure. In the web world this means that code stays where it should be , in servlets beans etc.

    I think it is a shame that Sun chose JSP as the templating mechanism for J2EE but it is not very surprising as they wanted to attract ASP programmers.

  5. Quit frankly, I don't know what you're trying to tell people. Though I don't know, to be fair, maybe you had something more to say, and accidentally hit the send button before saying it.

    If you are trying to imply that FreeMarker is a copy of Velocity, you are dead wrong. It is Velocity that began as a tweedledum-tweedledee copy of WebMacro.

    FreeMarker has been around for over 3 years and is not a copy of anything. The Lazarus release, FreeMarker 2.x introduces full support for arbitrary precision floating point numbers, which is something that Velocity does not have.

    Also, FreeMarker's approach is much more sound software engineering, since it does not (at least by default) expose all the public methods of your objects to the template layer.

    Frankly, I think you ought to open your mind a little bit.

    Cheers,

    Jonathan Revusky

    See http://freemarker.sourceforge.net/
    for more information about FreeMarker.
  6. I personally have allays prefered template engines over JSP, ASP, plain PHP and alike technologies. Basicaly because in my opion they they provide a natural solution to the problem of linking the two different tiers together. On contrary I find JSP to be a kind of solution to to the problem, but a forced one with a lack of elegance. Up until the recent history I saw few interest in template technology. Is this fundamentaly changing with the increasing popularity of products like Freemarker, Velocity, ... but also XSLT which can be used for the same purpose? What are the opinions on this subject?
  7. I never use JSP in any Java web applications, I always use WebMacro and any Java Web projects in our office are always based on WebMacro. It's a lot easier for designers to learn a template language. WebMacro is useful because it has quite a lot of built in helper classes.

    I appreciate that this is the basic divide between Velocity and WebMacro, Velocity are a lot more ascetic in their view of the templating tool, it should only provide basic functionality.

    However without going into religous differences I believe that WebMacro and Velocity are very similar. Velocity seems to gain more attention because it is part of the jakarta project.

    Most people that I have spoken to who have tried a template alternative to JSP seem convinced of the improvement.

     I would be interested to see how many other development teams have forgone the dubious delights of JSP.
  8. Template systems are one approach, but they aint the only one. Struts is a pretty good model view controller which discourages the scriptlets we all hate, and provides a good development framework to seperate flow and presentation logic.

    Jonathan
  9. I have been using struts in projects and it is indeed a good framework. A petty they chose taglibs instead of template technology.
  10. We have made the switch to Tapestry in my office. We had used some Velocity templates early on, but they were not powerful enough for our needs, and we didn't want to force our graphics designers to learn the template languages. Tapestry let's them deal with HTML, and only HTML.

    Jim
  11. Yes, you can do MVC using JSP, but using a templating tool makes it easier to maintain the MVC separation.

    FYI, work is underway to facilitate use of Velocity in conjunction with the Struts Controller servlet, ie. using Velocity instead of JSP. See

        http://jakarta.apache.org/velocity/toolsubproject.html

    There's also WebWork and Maverick ... both of which provide an MVC framework comparable with Struts, and support Velocity as an alternative to JSP.