Home  >  Q&A  >  body text

eclipse插件开发中,无法获取velocity模板

VelocityEngine ve = new VelocityEngine();
Properties p = new Properties();
p.put(Velocity.FILE_RESOURCE_LOADER_PATH, Activator.getDefault().getBundle().getLocation().replaceAll("reference:file:/", "") + "template");
ve.init(p);
Template template = ve.getTemplate(templateFilePath, inEncode);

上面的代码,在开发环境下是可以获取vm模板的,但是项目打成jar包后,放到eclipse的plugins目录下后,就找不到vm文件了。(vm文件已经打到jar包了)

其实就是想问p.put()的第二个参数,应该填啥。求指导,谢谢了。

ringa_leeringa_lee2696 days ago831

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-04-21 10:58:54

    rootPath = event.getServletContext().getRealPath("/");// Get the absolute path. By design, the caller implements its own path to pass in

    reply
    0
  • Cancelreply