You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Britta Katzenbach <ka...@liwa.de> on 2022/01/04 15:10:13 UTC

Problem Freemarker struts 2.5.27

Hi,

When switching from struts 2.5.26 to 2.5.27 we get the following error:

FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)


Template inclusion failed (for parameter value "/Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl"):
Template not found for name "Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl".
The name was interpreted by this TemplateLoader: org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@679bd9e8.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #include "/${parameters.templateDir}/...  [in template "template/simple/a-close.ftl" at line 40, column 1]
	
	
The problem is the following:
In a jsp page we use a struts iterator to iterate a list of objects to generate a link for each one. The objects do have a method "public Map<String, Object> getParameters()".
It seems that now FreeMarker calls the method getParameters from the object on the stack to find the templateDir (that cannot be found) instead of using the correct parameters as before with struts 2.5.26

We now renamed the method getParameters() to solve the problem, but we do not understand if it is a general issue with struts 2.5.27 or with this special situation.

Best regards,

Britta







Re: Problem Freemarker struts 2.5.27

Posted by Lukasz Lenart <lu...@apache.org>.
wt., 4 sty 2022 o 16:10 Britta Katzenbach <ka...@liwa.de> napisał(a):
> When switching from struts 2.5.26 to 2.5.27 we get the following error:
>
> FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)
>
>
> Template inclusion failed (for parameter value "/Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl"):
> Template not found for name "Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl".
> The name was interpreted by this TemplateLoader: org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@679bd9e8.
>
> ----
> FTL stack trace ("~" means nesting-related):
> - Failed at: #include "/${parameters.templateDir}/...  [in template "template/simple/a-close.ftl" at line 40, column 1]
> The problem is the following:
> In a jsp page we use a struts iterator to iterate a list of objects to generate a link for each one. The objects do have a method "public Map<String, Object> getParameters()".
> It seems that now FreeMarker calls the method getParameters from the object on the stack to find the templateDir (that cannot be found) instead of using the correct parameters as before with struts 2.5.26
>
> We now renamed the method getParameters() to solve the problem, but we do not understand if it is a general issue with struts 2.5.27 or with this special situation.

It's related to this change [1] and I will revert it soon as this
breaks previous behavior

[1] https://issues.apache.org/jira/browse/WW-5117


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem Freemarker struts 2.5.27

Posted by Lukasz Lenart <lu...@apache.org>.
Britta, James

I think that PR should fix the problem
https://github.com/apache/struts/pull/524


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

śr., 5 sty 2022 o 23:20 J. Chaplin <jc...@apache.org> napisał(a):
>
> Hello Britta.
>
> The behaviour you noted using Struts 2.5.27 appears to be equivalent to
> what was reported in a recent JIRA WW-5160.  A fix for JIRA WW-5117,
> introduced with Struts 2.5.27, appears to have introduced issues for
> actions that define a getParameters() method.
>
> Unfortunately I do not think I can answer your question as to whether it
> may be a general issue, or specific to the situation of actions with
> getParameters() methods defined.  The scenario for WW-5160 appears to be
> the only one reported so far, though.
>
> Maybe someone else on the mailing list can comment further ?
>
> Regards,
>
>       James.
>
> On 2022-01-04 10:10 a.m., Britta Katzenbach wrote:
> > Hi,
> >
> > When switching from struts 2.5.26 to 2.5.27 we get the following error:
> >
> > FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)
> >
> >
> > Template inclusion failed (for parameter value
> > "/Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl"):
> > Template not found for name
> > "Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl".
> > The name was interpreted by this TemplateLoader:
> > org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@679bd9e8.
> >
> > ----
> > FTL stack trace ("~" means nesting-related):
> > - Failed at: #include "/${parameters.templateDir}/...  [in template
> > "template/simple/a-close.ftl" at line 40, column 1]
> > The problem is the following:
> > In a jsp page we use a struts iterator to iterate a list of objects to
> > generate a link for each one. The objects do have a method "public
> > Map<String, Object> getParameters()".
> > It seems that now FreeMarker calls the method getParameters from the
> > object on the stack to find the templateDir (that cannot be found)
> > instead of using the correct parameters as before with struts 2.5.26
> >
> > We now renamed the method getParameters() to solve the problem, but we
> > do not understand if it is a general issue with struts 2.5.27 or with
> > this special situation.
> >
> > Best regards,
> >
> > Britta
> >
> >
> >
> >
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem Freemarker struts 2.5.27

Posted by "J. Chaplin" <jc...@apache.org>.
Hello Britta.

The behaviour you noted using Struts 2.5.27 appears to be equivalent to 
what was reported in a recent JIRA WW-5160.  A fix for JIRA WW-5117, 
introduced with Struts 2.5.27, appears to have introduced issues for 
actions that define a getParameters() method.

Unfortunately I do not think I can answer your question as to whether it 
may be a general issue, or specific to the situation of actions with 
getParameters() methods defined.  The scenario for WW-5160 appears to be 
the only one reported so far, though.

Maybe someone else on the mailing list can comment further ?

Regards,

      James.

On 2022-01-04 10:10 a.m., Britta Katzenbach wrote:
> Hi,
>
> When switching from struts 2.5.26 to 2.5.27 we get the following error:
>
> FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)
>
>
> Template inclusion failed (for parameter value 
> "/Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl"):
> Template not found for name 
> "Empty{name='templateDir'}/Empty{name='expandTheme'}/scripting-events.ftl".
> The name was interpreted by this TemplateLoader: 
> org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@679bd9e8.
>
> ----
> FTL stack trace ("~" means nesting-related):
> - Failed at: #include "/${parameters.templateDir}/...  [in template 
> "template/simple/a-close.ftl" at line 40, column 1]
> The problem is the following:
> In a jsp page we use a struts iterator to iterate a list of objects to 
> generate a link for each one. The objects do have a method "public 
> Map<String, Object> getParameters()".
> It seems that now FreeMarker calls the method getParameters from the 
> object on the stack to find the templateDir (that cannot be found) 
> instead of using the correct parameters as before with struts 2.5.26
>
> We now renamed the method getParameters() to solve the problem, but we 
> do not understand if it is a general issue with struts 2.5.27 or with 
> this special situation.
>
> Best regards,
>
> Britta
>
>
>
>
>
>