How to enable support for ftlx and ftlh types

#1

Hi All,

I am trying to enable auto escaping as mentioned [1]. However when I add a file with ftlx, it gives me error saying “file not found”. How can i enable support for these file type as well?

Thanks
Rahul

[1] https://freemarker.apache.org/docs/dgui_misc_autoescaping.html

#2

Hello Rahul,

Our product doesn’t support .ftlx and .ftlh extensions.

I know that it’s not ideal and will require manual work but you could use the deprecated ?html, ?xhtml and ?xml

An alternative that you could try and see if works is adding <#ftl output_format="{a valid output format}"> at the top of your ftl files.

Hope this helps and kind regards,
Lef

#3

On top of what Lef suggested, there’s also the option of setting an init parameter on the HstFreemarkerServlet like:

    <init-param>
      <param-name>outputFormat</param-name>
      <param-value>HTMLOutputFormat</param-value>
      <!-- Escape output as HTML by default  -->
    </init-param>

You can add this init param in site webapp’s web.xml file

#4

Thanks Lef & bcanvural.