Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Velocity (Storefront)

Velocity (Storefront)

Velocity is a templating engine. It is used to merge data from the application with HTML templates to generate the HTML that is displayed to user in the storefront. The velocity.xml file is located in the ep-storefront\src\main\resources\spring\views\velocity directory. It contains settings that allow you to configure the behavior of the Velocity engine.


Changes made to the Storefront velocity.xml should be applied to the Velocity (Commerce Manager) as well.

The cacheSeconds property of the globalMessageSource bean specifies how long message source resource files are cached. In production, it should be set to -1 (infinite). For testing purposes, it can be set to a positive value. This will allows you to test changes to message source resource files without having to restart your application or servlet container.

	<!-- message source to be used by velocity templates. -->
    <bean id="messageSource" class="com.elasticpath.commons.util.impl.StoreThemeMessageSource" >
		<property name="storeConfig" ref="threadLocalStorage"/commerce-legacy/>
		<property name="storeMessageSource" ref="storeMessageSourceDelegate"/commerce-legacy/>
		<!-- True if you want missing messages to show up as just the key used to look for them. e.g. user.firstname.
			 False will allow exception to be thrown, and stop template render. -->
       <property name="useCodeAsDefaultMessage">
	<bean id="storeMessageSourceDelegate" class="com.elasticpath.commons.util.impl.StoreMessageSourceImpl">
		<property name="messageSourceCache">
            <ref bean="messageSourceCache"/commerce-legacy/>
		<property name="globalMessageSource">
            <ref bean="globalMessageSource"/commerce-legacy/>
        <property name="settingsReader" ref="settingsReader"/commerce-legacy/>

	<bean id="globalMessageSource" class="">
	    <property name="basenames">
        <!-- Set cacheSeconds to -1 in Production Environment -->
	    <property name="cacheSeconds"><value>${ep.velocity.cache.seconds}</value></property>
	    <property name="defaultEncoding"><value>UTF-8</value></property>


For optimal performance, the following properties on the velocityProperties bean definition should also be set:

  • file.resource.loader.cache: Set this value to true for production to cache templates in Velocity's loader. Set this value to false for development so that changes to templates will take effect immediately.
  • velocimacro.library.autoreload: This parameter enables/disables automatic reloading of Velocity macros. Set this value to false for production. For development, setting this value to true will allow changes to Velocity macros to take effect without restarting the server. This requires file.resource.loader.cache to be set to false.
  • velocimacro.messages.on: Set this value to false for production for improved performance. When developing Velocity templates, this value can be set to true to see Velocity logging and debugging information.
  • runtime.log.logsystem.class: Set this value to org.apache.velocity.runtime.log.NullLogSystemas shown below for production.
    <entry key="runtime.log.logsystem.class"><value>org.apache.velocity.runtime.log.NullLogSystem</value></entry>