【发布时间】:2011-03-31 00:01:17
【问题描述】:
这个问题和这个问题有点相关:StackOverflow: Howto load a resource from WEB-INF directory of a web archive
我想使用 StringTemplate 并想通过 StringTemplateGroup 加载我的模板。直到知道我使用相关问题中显示的方法从 WEB-INF 文件夹中获取单个文件,但正如我 read here 一样,通过路径加载模板被认为是不好的做法,因为应用程序可能位于 WAR 文件中而且由于路径,我不能使用 StringTemplateGroup。
有没有一种您会推荐的方法来实现这一目标?我可以将整个文件夹作为类似流的对象供 StringTemplateGroup 读取,还是在 StringTemplate 中已经实现了一种体面(而不是那么 hackish)的方式?
我对 Java 有点陌生,但愿意学习 :) 非常感谢您。
【问题讨论】:
标签: java resources stringtemplate web-inf