Announcement Announcement Module
Collapse
No announcement yet.
Configure the objectwrapper for FreeMarker Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configure the objectwrapper for FreeMarker


    <bean id="beansWrapper" class="freemarker.ext.beans.BeansWrapper">
    <property name="exposeFields" value="true" />
    </bean>

    <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freema rker.FreeMarkerConfigurer">
    <property name="objectWrapper">
    <ref local="beansWrapper" />
    </property>
    <property name="templateLoaderPath">
    <value>/WEB-INF/views/</value>
    </property>
    </bean>


    That doesn't work, I get an exception:

    org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'objectWrapper' of bean class [org.springframework.web.servlet.view.freemarker.Fr eeMarkerConfigurer]: Bean property 'objectWrapper' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    setObjectWrapper needs an instance of ObjectWrapper, I thought I was passing one in this configuration.

  • #2
    Sorry to bump this, I forgot I had written it.

    I solved the problem though and I hate forum posts that pose a question, and then people go "oh, fixed it, it's cool" and not say anything.

    My solution to enable public properties on Freemarker is here: http://psikon.com/2012/08/29/springm...ic-properties/

    Comment

    Working...
    X