Announcement Announcement Module
Collapse
No announcement yet.
which Template Engine Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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,

    Comment


    • #3
      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.

      Comment


      • #4
        Hi,

        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

        Comment


        • #5
          Hi,

          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

          Comment


          • #6
            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.

            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

            Comment


            • #7
              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

              Comment


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

                Regards,

                Comment


                • #9
                  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

                  Comment

                  Working...
                  X