freemarker

Get templates from freemarker using Spring

I have started by looking in following thread - http://stackoverflow.com/questions/230763/getting-template-text-from-freemarker-in-spring-app My spring configuration - <bean id="fmConfig" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean"> <property name="templateLoaderPath" value="/WEB-INF/templates"></...

Multiple View resolvers in spring mvc

Hi, I want to use multiple view resolvers in my web app based on spring mvc Can anyone tell me how do I achieve that. I want to use both JSP and freemarker in my app. Please suggest some approaches or links or examples.. All help is appreciated. Adhir ...

best template engine in java

I am looking for a template engine with iteration, bifurcation, markup alike and that takes a string for template input rather a file. That's because I have my own way to supply the input template, and is not for a file. Also it's have to be opensource. Do you know something like this? ...

changing spring jsp date input bind in a form to use freemarker

I´m trying to change a spring jsp example to use freemarker. I changed all fields in a form with something like this: <@spring.formInput "account.name" /> Everything worked nicely. Form binded to the object and everything was validated, but I can`t get this part to work. <@spring.formInput "account.renewalDate" /> In jsp it was ren...

Struts2 + Sitemesh + Freemarker doesn't work

I've tried following every example i ccould find and i can't get struts2 + sitemesh + freemarker to work on a simple jsp. I have a very simple web.xml, a single action that just goes to index.jsp, and a simple .ftl decorator that just adds some text to the result. When i hit index.action, the page "seems" to be decorated, but I get the...

spring binding formmultiselect

I'm trying to bind multiselect to my object. The form is created and the post works and no errors occur when I don't select anything. If I select a language the object gets language value but the form breaks. HashMap<String, String> languages = new LinkedHashMap<String, String>(); languages.put("eng","english"); languag...

Unable to get values in ftl from value stack in custom Result Type

Hello, I am unable retrieve value from value stack in FTL file. Here is the code. Action class holds a property called 'name' private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public String execute(){ setName("From value stack .. "); return SUCCESS; } ...

Spring freemarker bind - what is controller?

looking at the documentation for the spring macros for freemarker they talk about the 'command' object... i am confused as to what that is? at first i thought it is just the ModleMap set by the controller, but its obviously not. What is the "bind" actually used for? ...

Encoding issues with Spring and Freemarker

I'm working on a project using Freemarker and Spring running on Jetty. It will involve displaying characters from many different countries so I'm trying to set the encoding to UTF-8. However, no matter what I do, it remains ISO-8859-1. I tried to create a filter in my web.xml and I've tried putting this response.setCharacterEncodin...

Web based RTE to generate Freemarker Templates

I would like to use a web based rich text editor to create a freemarker template that can then be used by my java application to generate output documents. Has anyone tried something like this before? Are there some RTE components that generate Freemarker output? TIA ...

Changing output of Forms with Struts+Freemarker

I'm working on a Website with Struts2 and Freemarker. Whenever I add form tags such as: <@s.form action="foo"> <@s.combobox (...)/> It generates a bunch of html/css/javascript that I don't need. Is there any way I can specify that no extra elements should be generated or do I really need to go into Freemarker.jar and edit...

Specifying Struts templates source

Say I'm using a form with a text-field. <@s.form action="login"> <@s.textfield label="E-mail" name="email"/> <@s.submit value="send"/> How can I specify that the text-form should be generated by a custom template (text_login.ftl) rather than the standard text.ftl? ...

Continuously 'Rendering template' on freemarker+struts2

I'm using struts2 with freemarker (included in struts2 lib) and i'm trying to speed up my web-app. In the logs continuously appear: UIBean.debug(57) | Rendering template /template/xhtml/a FreemarkerTemplateEngine.debug(57) | Rendering template /template/simple/a.ftl and this for each tag. The problem is that i don't know if it's nor...

Can I call sitemesh struts tags from a decorator in freemarker?

I know if you are using JSPs, you can call struts tags defined the normal way from a decorator, like this: <html> <body> <decorator:body /> </body> </html> but in the examples I always see using freemarker decorators, they will instead say: <html> <body> ${body} </body> </html> Is this the only way to include the pieces of ...

Freemarker/Velocity - date manipulation

Hello, I have a fairly simple question about these 2 templating engines. I'm trying to make a future/paste date, a fixed time from now, e.g. 18 months ago, or tomorrow. I know that it is possible to do this with a java date object inside a velocity/freemarker template (something like $date.add(2,-18)), but I would like to do this with D...

Can we use spring FTL based form validations with any controller other than SimpleFormController

Hi, Because of some design specification we have to extend all controllers in spring MVC from a class that extends AbstractCommandController. I am trying to include the spring FTL based form validations in my FTL file, but it gives me an error like Method public org.springframework.web.servlet.support.BindStatus org.springframewor...

In freemarker is it possible to check to see if a file exists before including it?

We are trying to build a system in freemarker where extension files can be optionally added to replace blocks of the standard template. We have gotten to this point <#attempt> <#include "extension.ftl"> <#recover> Standard output </#attempt> So - if the extension.ftl file exists it will be used otherwise the part inside of...

Can a freemarker interpolation contain an interpolation?

Let's say I have Freemarker variable A that contains the name of another variable on the hash tree, say. "B." I'd like to use a to read the value of B so, for example, if B contained "C" I could tell Freemarker to output C using A: ${${A}} should result in the output of "C". Naturally, this doesn't work in Freemarker, but is there a way ...

How to verify if a given string contains any Freemarker constructs?

Hi - What would be the most efficient way to check if a string contains any Freemarker constructs? e.g. Directives, macros etc. Essentially what is a good way to implement 'boolean isFreemarkerTemplate(String templateString)', so that I can decide whether to process it or not...? Thanks. ...

Use a single freemarker template to display tables of arbitrary pojos

Attention advanced Freemarker gurus: I want to use a single freemarker template to be able to output tables of arbitrary pojos, with the columns to display defined separately than the data. The problem is that I can't figure out how to get a handle to a function on a pojo at runtime, and then have freemarker invoke that function (lambd...