We have upgraded to Struts 6.0.0. The project Struts 2 jquery plugin version 4.0.3.
When loading a page we face this error:
Could not load the FreeMarker template named 'div':
Attempted: /template/jquery/div.ftl
Attempted: /template/xhtml/div.ftl
Attempted: /template/simple/div.ftl
The TemplateLoader provided by the FreeMarker Configuration was a: org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader
Could not open template
The stack trace cause is:
Caused by: freemarker.core.ParseException: Syntax error in template "template/jquery/div.ftl" in line 22, column 43:
Using ?html (legacy escaping) is not allowed when auto-escaping is on with a markup output format (HTML), to avoid double-escaping mistakes.
at freemarker.core.FMParser.BuiltIn(FMParser.java:1225)
at freemarker.core.FMParser.PrimaryExpression(FMParser.java:595)
at freemarker.core.FMParser.UnaryExpression(FMParser.java:707)
at freemarker.core.FMParser.MultiplicativeExpression(FMParser.java:822)
The line 22 in file template/jquery/div.ftl is as:
<#if parameters.id??> id="${parameters.id?html}"<#rt/></#if>
I am not familiar with Freemaker and I hope I could find a flag or something to by pass this.
I see the migration guide at https://cwiki.apache.org/confluence/display/WW/Struts+2.5+to+6.0.0+migration and also https://struts.apache.org/tag-developers/tag-syntax#escaping-body-of-a-tag but could not find the issue
I try to set struts.ui.escapeHtmlBody this in struts.xml but it did not help.
According to https://github.com/struts-community-plugins/struts2-jquery, for struts 6.0 the struts jQuery plugin 6.0 must be used.
Changing below in
pom.xmlfix it