Render Extension

The render extension, only available for web apps, enables users to embed the result of rendering a given path. It can be seen as another way to include other resources available throught HTTP GET endpoints. This extension exposes a new tag render.

render tag

The render tag is expecting a path to an internal resource and, optionally, a map of parameters. It will then create a new HttpServletRequest with the parameters provided in memory and ask the RequestDispatcher to include the resource with the given path.

{% render '/hello' with {name: 'Jtwig'} %}

The example above will make a call to render the servlet listening on the path /hello with the GET parameters name=Jtwig.


As shown below, the configuration of this extension is none. One just need to pass it on to the Environment configuration so it will be used.

                .extensions().add(new RenderExtension()).and()


Integrating Jtwig Render Extension on your project is quite simple with the help of dependency managers. To check the most recent version, go to bintray.


repositories {
dependencies {
    compile 'org.jtwig:jtwig-render-extension:1.X'





Check the jtwig-examples project on github for examples using this render engine.