Skip to content

Instantly share code, notes, and snippets.

@ndemengel
Created November 20, 2016 16:26
Show Gist options
  • Save ndemengel/08ad00f19a0436a589554fd2e0a3d515 to your computer and use it in GitHub Desktop.
Save ndemengel/08ad00f19a0436a589554fd2e0a3d515 to your computer and use it in GitHub Desktop.
Handlebars taglib example
<%@ taglib prefix="hbs" uri="http://www.hopwork.com/jsp/jstl/handlebars" %>
<%-- preferred form: all needed data are computed outside of the view and put into ${headerData} --%>
<hbs:render template="common/header" context="${headerData}"/>
<%-- sometimes, it's still useful to tweak the view independently of the data --%>
<hbs:render template="some/other/template">
<hbs:contextProperty name="someCondition" value="true"/>
<hbs:contextProperty name="someConfigProperty" value="SOME_CONFIG_VALUE"/>
<hbs:contextProperty name="data" value="${someData}"/>
</hbs:render>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment