You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (Jira)" <ji...@apache.org> on 2022/09/14 19:21:00 UTC
[jira] [Closed] (WW-3377) template location is not properly resolved when using action-tag
[ https://issues.apache.org/jira/browse/WW-3377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart closed WW-3377.
-----------------------------
Resolution: Not A Problem
> template location is not properly resolved when using action-tag
> ----------------------------------------------------------------
>
> Key: WW-3377
> URL: https://issues.apache.org/jira/browse/WW-3377
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.8
> Reporter: Philipp Leusmann
> Priority: Major
> Fix For: 6.1.0
>
>
> if an action-tag with executeResults=true includes an action from a different namespace and the template location of the included action in struts.xml is expressed relative to the namespace, template-loading for the included action fails. The template of the included action is searched for in the directory belonging to the namespace of the including action.
> Example:
> struts.xml:
> <package name="p1" extends="struts-default" namespace="/ns1">
> <action name="includingAction">
> <result type="freemarker" name="success">includer.ftl</result>
> </action>
> </package>
> <package name="p2" extends="struts-default" namespace="/ns2">
> <action name="includedAction">
> <result type="freemarker" name="success">included.ftl</result>
> </action>
> </package>
> and in includer.ftl:
> <@s.action name=includedAction" namespace="ns2" executeResults=true />
> Will result in an Exception:
> ERROR ActionComponent:27 - Could not execute action: /ns1/includingAction
> java.io.FileNotFoundException: Template /ns1/included.ftl not found.
> at freemarker.template.Configuration.getTemplate(Configuration.java:489)
> at freemarker.template.Configuration.getTemplate(Configuration.java:459)
> at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:168)
> [...]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)