实际上就把Velocity打个插件包上去,可参考Plugin配置.

解决方案 »

  1.   

    我正好在去年的项目中整合过,环境版本跟你的一样
    把Velocity1.5的jar包正确引用
    相关的使用代码:
    public class HtmlUtil {
        private static Log log = LogFactory.getLog(HtmlUtil.class);
        private VelocityContext context = null;  
        private Template template = null;  
    /**
         * 配置velocity环境
         * @param varp
         * @param path
         * @param proFile
         */
        public void setEnvir(Properties varp,String path,String proFile,String vmFile){
          Properties p = new Properties();  
             p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path); 
             p.setProperty(Velocity.RUNTIME_LOG, path + "velocity.log");  
             p.setProperty(Velocity.INPUT_ENCODING, "GBK");
             p.setProperty(Velocity.OUTPUT_ENCODING, "GBK");
             try {
    this.init(p,vmFile);//初始化VelocityEngine;
    FileInputStream in = new FileInputStream(proFile);   //template.properties
            varp.load(in);  //把template.properties读到Properties中
    } catch (Exception e) {
    log.info("%%%%%初始化VelocityEngine setEnvir():%%%%%%"+e.getMessage());
    }  
            
        } public void init(Properties properties,String vmFile) throws Exception {  
         VelocityEngine engine = new VelocityEngine();
         engine.init(properties);
         template = engine.getTemplate(vmFile);//把模板读到模板引擎去
            context = new VelocityContext(); 
        } }楼主看看 不知道是否对你有帮助