I've been trying to get freemarker to be able to perform a include in the same way as a jsp page does. As of Freemarker 2.3.15 this possible according to the manual (extract below)
Including content from other web application resources
You can use the <@include_page path="..."/> custom directive provided by the FreemarkerServlet (since 2.3.15) to include the contents of another web application resource into the output; this is often useful to integrate output of JSP pages (living alongside the FreeMarker templates in the same web server) into the FreeMarker template output. Using:
is identical to using this tag in JSP:
I noticed that jforum uses the 2.3.9 jar file so I have replace this with the 2.3.15 but if I try to use this directive I get a message telling me the directive can not be found:
on line 8, column 1 in default/header.htm include_page not found. The problematic instruction:
There is a note in the documentation that if the Application does not use freemarker.ext.servlet.FreemarkerServlet then this functionality is not available. My question is how do I get Jforum to use this? I have the src code from cvs in eclipse and I've tried a few things in the JForumBaseServlet but I can't seem to figure out how to get JForum to use this.
Don't know about freemarker and jsp, but I do know that jForum does use the servlet.
Instead, it creates a Freemarker TemplateConfig object in the JForumBaseServlet. Then uses this to get the FreeMarker template object in the Command object, process method. Which has it's process method called in the JForum.processCommand method.
Note, there may be a few other places that templates get processed or created via the TemplateConfig (like in the install servlet). So, you may need to search around a bit to make sure.
I wonder if you can add the right options to the TemplateConfig to get this to work? [originally posted on jforum.net by monroe]
Thanks, I notice there are a couple of methods available for Configuration that look like they might work but I don't seem to be able to get them to work and I don't seem to be able to find any documentation to explain how to do it.
You mentione that JForum does use the servlet but I couldn't see where this is being set up?
I've posted a message on the freemarker site too so hopefully someone will get back to me on how to get this working from there