Configuring Freemarker

The following example shows the typical approach used to configure a Freemarker view resolver.

First, the freemarkerConfig bean is used to load the Freemarker templates:

    <bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.
freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-
INF/freemarker/"/>
</bean>

The following bean definition shows how to configure a Freemarker view resolver:

    <bean id="freemarkerViewResolver"  
class="org.springframework.web.servlet.view.
freemarker.FreeMarkerViewResolver">
<property name="cache" value="true"/>
<property name="prefix" value=""/>
<property name="suffix" value=".ftl"/>
</bean>

As with JSPs, the view resolution can be defined using properties or an XML file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset