Announcement Announcement Module
No announcement yet.
Troubles with Velocity Toolbox Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Troubles with Velocity Toolbox

    I can't seem to get Velocity Toolbox set up correctly. I'm using VelocityLayoutViewResolver with VelocityLayoutView as my viewClass (which extends VelocityToolboxView).

    I am successfully using the date, number, and formatter basic tools without issue and now I'd like to use the math tool to round some numbers in a template.

    I've created a toolbox.xml file and set the toolboxConfigLocation attribute. This appears to get loaded correctly by the ToolboxManager, but the "key" name from the toolbox.xml is not available in my Velocity Context. How do I access the tools defined in toolbox.xml in my templates?

    I've also tried making a separate bean for VelocityLayoutView and setting the toolAttributes property (inherited from VelocityView). This property is then parsed during renderMergedTemplateModel and would place the tool(s) in the context:

    <bean id="viewClass" class="org.springframework.web.servlet.view.velocity.VelocityLayoutView">
        <property name="toolAttributes">
                <prop key="math"></prop>
    and then setting the viewClass attribute of VelocityLayoutViewResolver as a reference to that bean. However, I can't get that to initialize... eventually dying in due to a Null reference (this is probably a red herring).

    Lastly, I've also tried putting the tool directly into the template context in my controller as
    model.put("mathTool", new MathTool())
    but that doesn't work either.

    Thanks for any pointers!

  • #2
    hi,i have the same problem with you,now do you resolve?