Announcement Announcement Module
Collapse
No announcement yet.
Velocity - RHS of #set statement is null Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Velocity - RHS of #set statement is null

    Hello,
    I'm using the spring velocity macros in a page and they were working when I was using the ResourceBundleViewResolver but I needed to switch to the UrlBasedViewResolver so I can use the 'forward:action.do' syntax to forward to new controllers but now I get the errors from velocity. I'm assuming this is because the springMacroRequestContext is not available, is that correct? Am I using the correct attribute, or is there another property I need to set?

    my view resolver config look like:
    Code:
    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="suffix">
          <value>.vm</value>
        </property>
        <property name="prefix">
          <value>/</value>
        </property>
        <property name="viewClass">
        <value>org.springframework.web.servlet.view.velocity.VelocityToolboxView</value>
        </property>
        <property name="attributes">
          <props>
            <prop key="exposeSpringMacroHelpers">true</prop>
          </props>
        </property>
      </bean>
    TIA
    Michael Fortin

  • #2
    Just in case someone else came across the same problem, I figured it out on my own. The fallowing is the correct viewResolver to use:

    Code:
    <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
        <property name="suffix">
          <value>.vm</value>
        </property>
        <property name="prefix">
          <value>/</value>
        </property>
        <property name="exposeSpringMacroHelpers">
          <value>true</value>
        </property>
        <property name="exposeRequestAttributes">
          <value>true</value>
        </property>
        <property name="exposeSessionAttributes">
          <value>true</value>
        </property>
      </bean>
    mike

    Comment

    Working...
    X