mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-5117 Uses translateVariables instead of findString to allow join expressions
This commit is contained in:
@@ -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;
|
||||
@@ -1265,7 +1266,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);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class TextfieldTest extends AbstractUITagTest {
|
||||
|
||||
verify(TextFieldTag.class.getResource("Textfield-3.txt"));
|
||||
}
|
||||
|
||||
|
||||
public void testLabelSeparatorJsp() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("bar");
|
||||
@@ -172,13 +172,14 @@ public class TextfieldTest extends AbstractUITagTest {
|
||||
tag.setName("myname");
|
||||
tag.setValue("%{foo}");
|
||||
tag.setSize("10");
|
||||
tag.setDynamicAttribute(null, "anotherAttr", "another_%{foo}");
|
||||
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
verify(TextFieldTag.class.getResource("Textfield-5.txt"));
|
||||
}
|
||||
|
||||
|
||||
public void testSimple_recursionTestNoValue() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
testAction.setFoo("%{1+1}");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="myname" class="label">mylabel:</label></td>
|
||||
<td class="tdInput"><input type="text" name="myname" size="10" value="%{1+1}" id="myname"/></td>
|
||||
<td class="tdInput"><input type="text" name="myname" size="10" value="%{1+1}" id="myname" anotherAttr="another_%{1+1}"/></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user