本文介绍了在Spring 3.0.3中使用Velocity Tools的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我更新bean时:

<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
  <property name="cache" value="true"/>
  <property name="prefix" value=""/>
  <property name="suffix" value=".vm"/>
  <property name="toolboxConfigLocation" value="tools.xml" />
</bean>

使用Velocity Tools的tools.xml路径,我得到:

With the tools.xml path for Velocity Tools, I get:

Caused by: 
java.lang.ClassNotFoundException: org.apache.velocity.tools.view.ToolboxManager

我尝试插入工具版本2和1.4,但没有这种包结构。我错过了一些明显的东西吗什么版本的Velocity Tools是Spring / Velocity组件支持的?

I've tried plugging in tools version 2 and 1.4, neither have this package structure. Did I miss something obvious? What version of Velocity Tools is the Spring/Velocity component supporting?

推荐答案

默认情况下,Spring已经过时了Velocity支持。我从Spring扩展 VelocityView 类并覆盖 createVelocityContext 方法,我自己初始化Tools。 是它的看法结束。

Spring has very outdated Velocity support by default. I extend VelocityView class from Spring and override createVelocityContext method where I initialize Tools myself. Here is how it looks at the end.

这篇关于在Spring 3.0.3中使用Velocity Tools的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 20:58