JavaBean to configure Velocity for web usage, via the "configLocation"
and/or "velocityProperties" and/or "resourceLoaderPath" bean properties.
The simplest way to use this class is to specify just a "resourceLoaderPath";
you do not need any further configuration then.
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath"><value>/WEB-INF/velocity/</value></property>
</bean>
This bean must be included in the application context of any application
using Spring's VelocityView for web MVC. It exists purely to configure Velocity;
it is not meant to be referenced by application components but just internally
by VelocityView. Implements VelocityConfig to be found by VelocityView without
depending on the bean name of the configurer. Each DispatcherServlet can define
its own VelocityConfigurer if desired.
Note that you can also refer to a preconfigured VelocityEngine instance, for
example one set up by VelocityEngineFactoryBean, via the "velocityEngine" property.
This allows to share a VelocityEngine for web and email usage, for example.
This configurer registers the "spring.vm" Velocimacro library for web views
(contained in this package and thus in spring.jar), which makes all macros
defined in it implicitly available:
#springBind("person.age")
age is ${status.value}
author: Rod Johnson author: Juergen Hoeller author: Darren Davison See Also: VelocityConfigurer.setConfigLocation See Also: VelocityConfigurer.setVelocityProperties See Also: VelocityConfigurer.setResourceLoaderPath See Also: VelocityConfigurer.setVelocityEngine See Also: org.springframework.ui.velocity.VelocityEngineFactoryBean See Also: VelocityView |