In a .jsp I would use:
to display a message from my messages.properties file.
How would
Others are fine answers. Providing java config as example for those that use that.
@Bean(name = "freemarkerConfig")
public FreeMarkerConfigurer freemarkerConfig() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setTemplateLoaderPaths("/WEB-INF/views/", 'classpath:/templates');
Map map = new HashMap<>();
map.put("xml_escape", new XmlEscape());
configurer.setFreemarkerVariables(map)
def settings = new Properties()
settings['auto_import'] = 'spring.ftl as spring,layout/application.ftl as l,/macros/meh.ftl as meh'
configurer.setFreemarkerSettings(settings)
log.info "returning freemarker config"
return configurer;
}