I use velocity for both email and view(SpringMVC).
And the velocityEngine is set to be multi-resource loader
as followings.
Everything seems work fine except that when I move the
file template into dabatase, the rendering characters get
garbled.
Any advice will be appriciated!
Thanks
oracle10g charactersetCode:<!-- Part of ApplicationContext-velocity.xml --> <bean id="velocityLayoutViewResolver" class="....VelocityLayoutViewResolver"> <property name="viewClass"> <value>...VelocityLayoutView</value> </property> <property name="toolboxConfigLocation"> <value>/WEB-INF/toolbox.xml</value> </property> <property name="contentType"> <value>text/html;charset=UTF-8</value> </property> </bean> <bean id="velocityConfigurer" class="...VelocityConfigurer"> <property name="velocityEngine"> <ref bean="velocityEngine"/> </property> </bean> <bean id="velocityEngine" class="...VelocityEngineFactoryBean"> <property name="velocityPropertiesMap"> <map> <entry key="resource.loader"><value>file, ds</value></entry> <entry key="ds.resource.loader.instance"> <ref bean="dbLoader"/> </entry> <entry key="ds.resource.loader.resource.table"> <value>velocity_template_table</value> </entry> <entry key="ds.resource.loader.resource.keycolumn"> <value>template_name</value> </entry> <entry key="ds.resource.loader.resource.templatecolumn"> <value>template_content</value> </entry> <entry key="ds.resource.loader.resource.timestampcolumn"> <value>template_timestamp</value> </entry> <entry key="file.resource.loader.class"> <value>org.apache.velocity.runtime.resource.loader.FileResourceLoader</value> </entry> <entry key="file.resource.loader.path"> <value>${myweb.root}/WEB-INF/velocity</value> </entry> <entry key="input.encoding"> <value>UTF-8</value> </entry> </map> </property> </bean> <bean id="dbLoader" class="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader"> <property name="dataSource"><ref bean="dataSource"/></property> </bean>
velocity-1.5Code:>SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET' UTF8
velocity-tools-view-1.3


Reply With Quote