I am having a problem getting the Template Representation working in Restlet.
I am using the Template Representation because I have 3 pages that are similar apart from thecontent (I.e header, navigation and footer are the same): index.html, services.html, contact.html Using the template representation will be useful because if I need to change the navigation bar or footer then I will only need to do it in one place (template.html)
I have added the FreeMarker jars to my build path and I can get access to the template data.
I am trying something basic to begin with:
@Get
public Representation represent() {
return new TemplateRepresentation("template.html", new Configuration(), MediaType.TEXT_HTML);
}
I expect whatever is in template.html
to show on the browser. but I get the error No template found
in the console
Here is a cut down version of my file structure.
Java Resources
- src
- Application.java
- IndexResource.java (This class contains the template representation to show the index page)
Web Content
- WEB-INF
- template.html