如何从struts2罐中获取velocityengine

如何从struts2罐中获取velocityengine,struts2,velocity,Struts2,Velocity,我正在尝试为基于Struts2的Web应用程序编写一个动态邮件系统。 我想使用velocity作为模板工具,我想知道我是否可以使用与struts2捆绑的velocity,或者我需要获得velocity JAR的独立副本 到目前为止我已经试过了 VelocityManager vm = new VelocityManager(); VelocityEngine ve = vm.getVelocityEngine(); 但是eclipse抱怨说,由于这个错误,VelocityEngine类丢失了

我正在尝试为基于Struts2的Web应用程序编写一个动态邮件系统。 我想使用velocity作为模板工具,我想知道我是否可以使用与struts2捆绑的velocity,或者我需要获得velocity JAR的独立副本

到目前为止我已经试过了

VelocityManager vm = new VelocityManager();
VelocityEngine ve = vm.getVelocityEngine();
但是eclipse抱怨说,由于这个错误,VelocityEngine类丢失了

The method getVelocityEngine() from the type VelocityManager refers to the missing type VelocityEngine
我该怎么办


谢谢该类
VelocityEngine
打包在
velocity-1.6.4.jar
中。您应该将此文件添加到生成路径。如果您使用的是maven,那么它应该自动解决依赖关系。Struts2支持用作模板处理器。你应该阅读文档如何使用

谢谢你的回答。我很清楚,struts只将velocity用作结果模板处理器,这不是我的目标。包括Velocity dependecy不会与struts的捆绑版本冲突吗?不,它使用jsp、fremarker和Velocity。它已经绑定,应该从
struts2 core
解析。请参阅dependency tree。是的,没错,但是eclipse不允许我包含struts2包中的velocity,尽管我可以看到VelocityEngine.class文件。eclipse配置构建路径时有问题吗?