我有email.ftl
在modules/portal/web/WEB-INF/templates/email /下(我创建的子文件夹)。在我的控制器代码中,我有我的EmailInfo声明,并且我想指定email.ftl的路径。在this tutorialCUBA-Platform + EmailInfo - 如何在WEB-INF下指定FTL模板路径?
看,我看到了EmailInfo声明是这样的:
EmailInfo emailInfo = new EmailInfo(
"[email protected],[email protected]",
newsItem.getCaption(),
null,
"com/company/demo/templates/news_item.txt",
Collections.singletonMap("newsItem", newsItem)
);
我注意到相对路径从com/
news_item.txt开始这使我相信,路径的根从开始控制器所在模块的“src”文件夹(我的控制器在应用程序入口中,因此在我的情况下为portal/src
)。由于我的模板是web/
而不是src/
下,我指定我的道路像这样:
EmailInfo emailInfo = new EmailInfo("[email protected]", "Email Template", null, "../web/WEB-INF/templates/email/email.ftl", null, null);[/pre]
然而,它没有工作,因为一个错误被抛出:
java.lang.IllegalArgumentException异常:无法找到路径模板:../web/WEB-INF/templates/email/email.ftl
所以我的问题是,如何确定该文件路径下的子文件夹不同的走,特别是“模块/门户网站/网页“?
感谢,乐居
从CUBA平台论坛==== X-发布