How to enable support for ftlx and ftlh types

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

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

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

Thanks Lef & bcanvural.