diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java index f55e6f0c6..d64a58fee 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java @@ -25,6 +25,7 @@ import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ObjectFactory; import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.util.ClassLoaderUtil; +import com.opensymphony.xwork2.util.TextParseUtil; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; @@ -148,6 +149,10 @@ public class StrutsUtil { return (request == null)? "" : request.getContextPath(); } + public String translateVariables(String expression) { + return TextParseUtil.translateVariables(expression, stack); + } + /** * the selectedList objects are matched to the list.listValue *

diff --git a/core/src/main/resources/template/simple/dynamic-attributes.ftl b/core/src/main/resources/template/simple/dynamic-attributes.ftl index 1edf7bc8f..dc5c3be85 100644 --- a/core/src/main/resources/template/simple/dynamic-attributes.ftl +++ b/core/src/main/resources/template/simple/dynamic-attributes.ftl @@ -23,6 +23,8 @@ <#if (parameters.dynamicAttributes?? && parameters.dynamicAttributes?size > 0)><#rt/> <#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/> <#list aKeys as aKey><#rt/> - ${aKey}="${parameters.dynamicAttributes[aKey]?html}"<#rt/> + <#assign keyValue = parameters.dynamicAttributes[aKey]/> + <#assign value = struts.translateVariables(keyValue)!keyValue/> + ${aKey}="${value?html}"<#rt/> <#rt/> <#rt/> \ No newline at end of file diff --git a/core/src/main/resources/template/simple/radiomap.ftl b/core/src/main/resources/template/simple/radiomap.ftl index 4b07f6895..fa5f9ac3b 100644 --- a/core/src/main/resources/template/simple/radiomap.ftl +++ b/core/src/main/resources/template/simple/radiomap.ftl @@ -61,6 +61,7 @@ <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /><#rt/>