views:

26

answers:

1

In a .jsp I would use:

<fmt:message key="welcome.title"/>

to display a message from my messages.properties file.

How would I do this with freemarker ?

+1  A: 

Import Spring Macro

<#import "/spring.ftl" as spring/>

Then

<@spring.message "yourMessageKeyGoesHere"/>

But you need to register ResourceBundleMessageSource

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basename" value="messages"/>
</bean>

Keep in mind MessageSource must be called messageSource

Arthur Ronald F D Garcia
so each and every freemarker template has to import?
Blankman
@Blankman I am not sure but I Think so
Arthur Ronald F D Garcia