Web applications struts2 org.apache.velocity.exception.ResourceNotFoundException中出现此错误的原因:无法找到资源';template.vm';
我正在为我的web应用程序html电子邮件实用程序使用Apache Velocity模板引擎 但我面临的主要问题是资源路径。 我将struts2用于我的web应用程序(struts2 maven arch..project) &我已经创建了文件夹模板&在其中我创建了email.vm文件,它是模板,所以我将模板文件夹移动到了资源(所以当创建war时,它将转到WEB-INF/classes文件夹) &在我的实用程序类中,我尝试获取以下模板:Web applications struts2 org.apache.velocity.exception.ResourceNotFoundException中出现此错误的原因:无法找到资源';template.vm';,web-applications,struts2,velocity,Web Applications,Struts2,Velocity,我正在为我的web应用程序html电子邮件实用程序使用Apache Velocity模板引擎 但我面临的主要问题是资源路径。 我将struts2用于我的web应用程序(struts2 maven arch..project) &我已经创建了文件夹模板&在其中我创建了email.vm文件,它是模板,所以我将模板文件夹移动到了资源(所以当创建war时,它将转到WEB-INF/classes文件夹) &在我的实用程序类中,我尝试获取以下模板: VelocityEngine ve = new Veloc
VelocityEngine ve = new VelocityEngine();
ve.init();
VelocityContext context = new VelocityContext();
context.put("petList", list);
log.info("Context added");
/*
* get the Template
*/
Template t = ve.getTemplate("email.vm" );
log.info("Got Template");
/*
* now render the template into a Writer, here
* a StringWriter
*/
StringWriter writer = new StringWriter();
t.merge( context, writer );
所以我犯了一个错误
org.apache.velocity.exception.ResourceNotFoundException:找不到资源“template.vm”
我在stackoverflow中查看了与此相关的所有问题并应用了解决方案,但仍然没有成功
那么,有人能告诉我我做错了什么或错过了什么吗???读这个和这个。下次使用谷歌。仔细阅读了一个小时后,我才知道它是如何工作的。谢谢你的回答