Skip to content

Instantly share code, notes, and snippets.

@uklance
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uklance/a6bda84895b7912b7999 to your computer and use it in GitHub Desktop.
Save uklance/a6bda84895b7912b7999 to your computer and use it in GitHub Desktop.
Dynamic template usage
public class MyPage {
@Inject
private DynamicTemplateParser parser;
public DynamicTemplate getMyDynamicTemplate() {
// if you want this to come from a string you might need to
// implement a StringResource by extending AbstractResource
Resource resource = new ClasspathResource("path/to/some-template.tml");
return parser.parseTemplate(resource);
}
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<body>
<t:dynamic template="prop:myDynamicTemplate" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment