Anna T
Anna T

Reputation: 955

How to configure Maven Freemarker to recognize `@include_page` tag?

I'm trying to use the @include_page macro from FreemarkerServlet - using Maven Freemarker framework with Freemarker version 2.3.31 and I can see the notes about this tag being now available in the source of it, but it still is not resolved/recognized in the actual template output.

For context:

<#assign....>
.
.
.
<div>
 <@include_page path="hello.jsp"/>
</div>
.
.
.

Does anyone know if there is some additional configuration needed to make use of it?

Upvotes: 0

Views: 209

Answers (2)

Anna T
Anna T

Reputation: 955

The issue was that we needed to add the

model.put( FreemarkerServlet.KEY_INCLUDE, new IncludePage( request,
        response ) );

to the FreemarkerView model.

This is the post that actually solves the problem.

Upvotes: 1

ddekany
ddekany

Reputation: 31152

To use JSP support (and include_page is part of it) you have to invoke the template with forwarding to an URL that's mapped to the FreemarkerServlet, instead of directly calling FreeMarker with its Java API. It's just how JSP works too (or have worked, originally). See https://freemarker.apache.org/docs/pgui_misc_servlet.html for details.

Upvotes: 0

Related Questions