freemarker

Template Engines for Spring Framework

I've taken quite a shine to the Spring Framework and would like to get into it a bit more. I have noticed that aside from plain vanilla JSPs there are various template engines for use with Spring MVC, such as Velocity and Freemarker. Are there others? Which one do you recommend? ...

Internationalization sitemesh

I'm using freemarker, SiteMesh and Spring framework. For the pages I use ${requestContext.getMessage()} to get the message from message.properties. But for the decorators this doesn't work. How should I do to get the internationalization working for sitemesh? ...

Template-Engine for Struts

Freemarker, Tiles oder Velocity? Which template engine is the best for a multi-user-system build with struts? ...

Suggestions for a Java-based templating engine?

Do you know a better template engine than FreeMaker or Velocity? ...

tiles in struts project - better than freemarker?

I want to use a template engine in a struts application and would like to know if using TILES can be recommended instead of FREEMARKER or VELOCITY. ...

Can anyone point me to Spring MVC, Tiles, Freemarker integration example?

In my Spring MVC based applications i use Freemarker and i like it very much, but it's lacking advantages provided by Composite View pattern. I'm thinking of trying to use Tiles2 together with Freemarker - does anyone know where do i find a simple example of SpringMVC together with Tiles2+Freemarker? ...

Getting template text from FreeMarker in Spring app

Hi, In my Spring app, I'd like to use FreeMarker to generate the text of emails that will be sent by my application. The generated text will never be returned to the view so I don't need to configure a FreeMarker view resolver. The documentation seems to indicate that I should configure a FreeMarkerConfigurationFactoryBean like this <b...

cache FreeMarker templates

Hi, I'm using the Spring class FreeMarkerConfigurationFactoryBean to retrieve FreeMarker templates. I would like these templates to be cached, but there doesn't appear to be any way to indicate that this behaviour is required. In contrast, Spring modules provides a CachingTemplateResolver which does provide template caching, but is it ...

Spring + Tiles2 + Freemarker - integrate via Freemarker Servlet or via Spring's FreeMarkerViewResolver?

Hi all, i was strugling today trying to migrate from Freemarker to Tiles2 + Freemarker. My freemarker templates use macros that come from spring.ftl. If i provide a fremarker servlet in web.xml, my model is visible to freemarker, but specific spring variables (naturally) are not populated into the model as springs FreemarkerView is r...

Passing Parameter to struts2 component

I am attempting to create a struts2 component using freemarker. I created a ftl file with code like this: <script type="text/javascript" src="${parameters.library?default('')}"></script> Which is expecting a parameter named library to be passed to the component. If the parameter is absent then it defaults to a blank string. On my JSP...

if-else in FreeMarker template

Hi, FreeMarker templates support an if-statement with the following syntax <#if hot> It's hot. </#if> I've looked in the documentation and can't find any support for an if-else statement. Of course I could achieve the same result with: <#if hot> It's hot. </#if> <#if !hot> It's not hot. </#if> Is support for if-else pro...

How to check if a variable exists in a FreeMarker template?

Hi, I have a Freemarker template which contains a bunch of placeholders for which values are supplied when the template is processed. I want to conditionally include part of the template if the userName variable is supplied, something like: [#if_exists userName] Hi ${userName}, How are you? [/#if_exists] However, the FreeMarker man...

How to load javascript files using google.load instead of directly using tag in freemarker template language?

How to load javascript files using google.load instead of directly using tag in freemarker template language? ...

Load FreeMarker templates from database

Hi, I would like to store my FreeMarker templates in a database table that looks something like: template_name | template_content --------------------------------- hello |Hello ${user} goodbye |So long ${user} When a request is received for a template with a particular name, this should cause a query to be executed, whi...

bypass FreeMarker caching?

Is it possible to bypass the Freemarker cache when certain templates are requested? I realise that I'll probably have to implement my own TemplateLoader in order to do this, but even so, I can't see a way to check the cache when say template A is requested, but bypass it when template B is requested? If this is not possible, I'll just h...

Does anyone know of a Python equivalent of FMPP?

Does anyone know of a Python equivalent for FMPP the text file preprocessor? Follow up: I am reading the docs and looking at the examples for the suggestions given. Just to expand. My usage of FMPP is to read in a data file (csv) and use multiple templates depending on that data to create multi page reports in html all linked to a main ...

Alternating table row colors in freemarker

What's a good, simple way to have alternate row coloring with freemarker? Is this really the best way? <#assign row=0> <#list items as item> <#if (row % 2) == 0> <#assign bgcolor="green"> <#else> <#assign bgcolor="red"> </#if> <tr style='background-color: ${bgcolor}'><td>${item}</td></tr> <#assign r...

Sandboxing Java / Groovy / Freemarker Code - Preventing execution of specific methods

I'm developing a system that allows developers to upload custom groovy scripts and freemarker templates. I can provide a certain level of security at a very high level with the default Java security infrastructure - i.e. prevent code from accessing the filesystem or network, however I have a need to restrict access to specific methods. ...

List of String in Freemarker

I have a list of string in java code: List keywords = new ArrayList(); keywords.add("Apple"); keywords.add("Banana"); and I would like to display the keywords using Freemarker: Apple, Banana How to do that? PS: I read through the manual and found some articles suggesting using <#list>, but the output is: Apple Banana ...

SpringMVC and FreeMarker

Hi everybody! I hope someone can help me.. I have the follow code: <@formInput "${value}", "tabindex=\"${index}\" class=\"yui-ac-input\"", "text"/> For the Input tag, the attibute VALUE obtains the value of "${value}" My problem appears when the user inserts a apostrophe in the input field. (') I used the escaped method of the manual ...