Results 1 to 3 of 3

Thread: Encoding for freemarkertemplates

  1. #1
    Join Date
    Oct 2004
    Posts
    151

    Default 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. #2
    Join Date
    Nov 2004
    Posts
    3

    Default 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>

  3. #3
    Join Date
    Oct 2004
    Posts
    151

    Default 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

Similar Threads

  1. How to set attachment 's encoding
    By kongqz in forum Data
    Replies: 3
    Last Post: Jun 30th, 2006, 01:38 AM
  2. displaying UTF-8 character encoding
    By marc65 in forum Web
    Replies: 7
    Last Post: Mar 2nd, 2006, 06:51 AM
  3. Replies: 2
    Last Post: Jul 12th, 2005, 11:03 AM
  4. Replies: 2
    Last Post: May 25th, 2005, 07:38 PM
  5. Replies: 0
    Last Post: Dec 7th, 2004, 04:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •