Results 1 to 9 of 9

Thread: which Template Engine

  1. #1
    Join Date
    Oct 2004
    Location
    Germany
    Posts
    143

    Default which Template Engine

    Hello,

    which Template Engine is the best for:

    - no use of Java Code inside the JSP View
    - the design should be alterable by nonJava developers.
    - it should be possible to use dynamic Template Code, so I can insert template code into the DB and when viewing this, it should be parsed by the Template-Engine
    (- it should be nice if the Template Engine is not bound to the Webapplication)

    later I will add XML and PDF Output (maybe PDF is not used by The Template because spring is doing this)

    I think the engines which can do this are Freemaker and Velocity, but which is the best for my needs? can Freemaker and Velocity work with dynamik template Code? (as I described in point 3) JSTL can't do this so it is not good for me.

    Thank you.

    mfg Gideon

  2. #2
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    I think either Velocity or FreeMarker would meet all of your needs. I've never loaded templates from a *database* however (I assume you mean RDBMS) but either framework will recognize and reload templates that have changed on a file system.

    Regards,
    Darren Davison.
    Public Key: 0xE855B3EA

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Both Velocity and FreeMarker can load from a JDBC or other repository. Check out http://freemarker.sourceforge.net/do...teloading.html for information on FreeMarker template loaders.

    Which of the two to use? There's a page at http://freemarker.sourceforge.net/fmVsVel.html. FWIW, I've used both and these days use FreeMarker as it allows you to write more powerful macros.

  4. #4
    Join Date
    Oct 2004
    Location
    Germany
    Posts
    143

    Default

    Hi,

    Quote Originally Posted by davison
    I think either Velocity or FreeMarker would meet all of your needs. I've never loaded templates from a *database* however (I assume you mean RDBMS) but either framework will recognize and reload templates that have changed on a file system.
    ok, I think i will test them both and than I must see which one is better.

    which one prefer you?

    database, yes I mean a RDBMS, it is not correct say database for RDBMS in english? in german it is, so if not, sorry please.

    mfg Gidion

  5. #5
    Join Date
    Oct 2004
    Location
    Germany
    Posts
    143

    Default

    Hi,

    Quote Originally Posted by Ben Alex
    Both Velocity and FreeMarker can load from a JDBC or other repository. Check out http://freemarker.sourceforge.net/do...teloading.html for information on FreeMarker template loaders.

    Which of the two to use? There's a page at http://freemarker.sourceforge.net/fmVsVel.html. FWIW, I've used both and these days use FreeMarker as it allows you to write more powerful macros.
    ok thank you, more powerfull macros should be interesting.

    mfg Gideon

  6. #6
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    Quote Originally Posted by Gideon
    which one prefer you?
    FreeMarker is more powerful and I would use it where templates could get complex, but I prefer Velocity for its readability and would use it in simpler applications/templates.

    Quote Originally Posted by Gideon
    database, yes I mean a RDBMS, it is not correct say database for RDBMS in english? in german it is, so if not, sorry please.
    RDBMS is a subset of 'database'. There are other types of database so I was just checking that's what you meant

    Ben confirmed that you can read templates from an RDBMS, but I was unsure whether changes to those templates would implicitly be reloaded as they are with file system templat changes. No reason why they shouldn't be, I've just never done it.

    Regards
    Darren Davison.
    Public Key: 0xE855B3EA

  7. #7
    Join Date
    Oct 2004
    Location
    Germany
    Posts
    143

    Default

    Hi,

    ok i will test both, becaus i found this on the Freemarker vs. Velocity:
    Advanced template metaprogramming:

    * You can capture the output of an arbitrary part of the template into a context variable.
    * You can interpret arbitrary context variable as if it were a template definition.
    * You can imagine what can you do when you combine the two...
    I think this is what I need (or what I mean with dynamik Template Code) , so I have to test if Velocity can handle this.

    thanks.

    mfg Gideon

  8. #8
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    Velocity can evaluate dynamic code snippets held in context variables via its RenderTool (I think it's called).

    Regards,
    Darren Davison.
    Public Key: 0xE855B3EA

  9. #9
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Although Freemarker allows for more powerful macros, Velocity allows you to write your own directives in Java giving your full access to the underlying syntax tree. With this functionality you can do anything.

    Rob

Similar Threads

  1. Spring-based Mail Template Framework
    By eisenb in forum Architecture
    Replies: 3
    Last Post: Dec 2nd, 2010, 07:24 AM
  2. Template engine + JSTL
    By simtin in forum Web
    Replies: 5
    Last Post: Sep 6th, 2005, 03:18 AM
  3. Hibernate Template or AOP Interceptor?
    By etienno in forum Data
    Replies: 1
    Last Post: Apr 15th, 2005, 02:44 AM
  4. Problem using parent abstract template bean
    By Fernando Olcoz in forum AOP
    Replies: 2
    Last Post: Feb 2nd, 2005, 07:58 AM
  5. Project that uses Spring: Zilverline search engine
    By jbetancourt in forum Architecture
    Replies: 0
    Last Post: Oct 19th, 2004, 06:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •