Announcement Announcement Module
Collapse
No announcement yet.
Encoding for freemarkertemplates Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Encoding for freemarkertemplates

    Hi!

    How can I specify default encoding for freemarker templates when using my viewResolver-bean (freeMarkerViewResolver) and use new ModelAndView("my_template", ...)?

    When creating a bean for the freemarker template I can use a property to specify encoding.

    Code:
        <bean id="temaforsideView" 
            class="org.springframework.web.servlet.view.freemarker.FreeMarkerView">
            <property name="url">
                <value>temaforside_page.ftl</value>
            </property>
            <property name="encoding">
                <value>UTF-8</value>
            </property>
            <property name="exposeSpringMacroHelpers">
                <value>true</value>
            </property>
        </bean>
    TIA!


    -Kaj

  • #2
    try this

    Code:
      <bean id="viewResolver" 
            class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
        <property name="cache"><value>true</value></property>
        <property name="prefix"><value></value></property>
        <property name="suffix"><value>.ftl</value></property>
        <property name="contentType"><value>text/html; charset=UTF-8</value></property>
      </bean>

    Comment


    • #3
      Re: try this

      Thank you for answering!

      After some copy/paste from

      http://opensource.atlassian.com/proj...browse/SPR-127

      this now works just fine!



      -Kaj

      Comment

      Working...
      X