WW-5117 Uses translateVariables instead of findString to allow join expressions

This commit is contained in:
Lukasz Lenart
2022-01-06 09:03:07 +01:00
parent a4a4e9e262
commit b0e18e9c57
2 changed files with 4 additions and 2 deletions
@@ -20,6 +20,7 @@ package org.apache.struts2.components;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@@ -1278,7 +1279,8 @@ public abstract class UIBean extends Component {
if (!isValidTagAttribute(attrName)) {
if (ComponentUtils.altSyntax(getStack()) && ComponentUtils.containsExpression(attrValue) && !lazyEvaluation()) {
dynamicAttributes.put(attrName, ObjectUtils.defaultIfNull(findString(attrValue), attrValue));
String translated = TextParseUtil.translateVariables('%', attrValue, stack);
dynamicAttributes.put(attrName, ObjectUtils.defaultIfNull(translated, attrValue));
} else {
dynamicAttributes.put(attrName, attrValue);
}
@@ -372,7 +372,7 @@ public class TextfieldTest extends AbstractUITagTest {
tag.setName("myname");
tag.setValue("%{foo}");
tag.setSize("10");
tag.setDynamicAttribute(null, "anotherAttr", "%{foo}");
tag.setDynamicAttribute(null, "anotherAttr", "another_%{foo}");
tag.doStartTag();
setComponentTagClearTagState(tag, true); // Ensure component tag state clearing is set true (to match tag).