我在使用Restlet模板表示形式时遇到问题。获取restlet模板表示形式
我使用的模板表示,因为我有3页是从thecontent除了类似(即标题,导航和页脚是相同的): 的index.html,services.html,contact.html 使用模板表示将是有用的,因为如果我需要更改导航栏或页脚,那么我将只需要在一个地方完成(template.html)
我已将FreeMarker罐添加到我的构建路径,并且可以访问模板数据。
我想一些基本的东西,开始与:
@Get
public Representation represent() {
return new TemplateRepresentation("template.html", new Configuration(), MediaType.TEXT_HTML);
}
我希望无论是在template.html
显示在浏览器上。但我得到控制台中的错误No template found
这是我的文件结构的减少版本。
Java Resources
- src
- Application.java
- IndexResource.java (This class contains the template representation to show the index page)
Web Content
- WEB-INF
- template.html
尝试将日志级别调高为DEBUG或ALL,以便您可以看到TemplateRepresentation类正在尝试执行的操作。 template.html文件不是TemplateRepresentation期望找到的地方,而且日志很可能会告诉你它在哪里查找。 – jmort253