Customize speed tools with spring 3.x

I am new to both spring and speed I want to configure speed tools using spring 3.x but I could not find a good article that + the speed template does not show the session variable I set from the spring controller

+3
source share
2 answers

Regarding the configuration of Velocity tools in spring 3.x, first place the tools.xml file somewhere useful, for example: /WEB-INF/vm/toolbox.xml Then configure the viewer in this place:

<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
    ...
    <!--Other config properties in here -->
    ...
    <property name="toolboxConfigLocation" value="/WEB-INF/vm/toolbox.xml" />
</bean>

An example toolbox.xml file:

<toolbox>
<xhtml>true</xhtml>
<tool>
    <key>date</key>
    <scope>application</scope>
    <class>org.apache.velocity.tools.generic.DateTool</class>
    <parameter name="format" value="dd/MM/yyyy" />
</tool>
<tool>
    <key>display</key>
    <scope>application</scope>
    <class>org.apache.velocity.tools.generic.DisplayTool</class>
</tool>
<tool>
    <key>math</key>
    <scope>application</scope>
    <class>org.apache.velocity.tools.generic.MathTool</class>
</tool>
<tool>
    <key>iter</key>
    <scope>application</scope>
    <class>org.apache.velocity.tools.generic.IteratorTool</class>
</tool>
<tool>
    <key>sort</key>
    <scope>application</scope>
    <class>org.apache.velocity.tools.generic.SortTool</class>
</tool>
</toolbox>

Hope this bit helps, at least.

+4
source

, , , , . : Spring MVC, Spring, Velocity. -, Spring MVC JSP, Velocity JSP.

, Spring MVC, : http://blog.springsource.com/2011/01/04/green-beans-getting-started-with-spring-mvc/

, , ( ) Spring Velocity : http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/view.html#view-velocity

, VelocityViewResolver, , InternalResourceViewResolver . .vm Velocity .jsp .

0

All Articles