mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-3828 adds support for dynamic attributes not only for String literals but for other objects
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1343701 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -24,7 +24,11 @@
|
||||
<#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/>
|
||||
<#list aKeys as aKey><#rt/>
|
||||
<#assign keyValue = parameters.dynamicAttributes[aKey]/>
|
||||
<#assign value = struts.translateVariables(keyValue)!keyValue/>
|
||||
<#if keyValue?is_string>
|
||||
<#assign value = struts.translateVariables(keyValue)!keyValue/>
|
||||
<#else>
|
||||
<#assign value = keyValue?string/>
|
||||
</#if>
|
||||
${aKey}="${value?html}"<#rt/>
|
||||
</#list><#rt/>
|
||||
</#if><#rt/>
|
||||
@@ -216,7 +216,8 @@ public class FreeMarkerResultTest extends StrutsTestCase {
|
||||
ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
|
||||
dispatcher.serviceAction(request, response, servletContext, mapping);
|
||||
String expected = "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>"
|
||||
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>";
|
||||
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>"
|
||||
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" break=\"true\"/>";
|
||||
assertEquals(expected, stringWriter.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,4 +21,5 @@
|
||||
*/
|
||||
-->
|
||||
<@s.textfield name="test" dynamicAttributes={"placeholder":"input","foo":"bar"}/>
|
||||
<@s.textfield name="test" placeholder="input" foo="bar"/>
|
||||
<@s.textfield name="test" placeholder="input" foo="bar"/>
|
||||
<@s.textfield name="test" break=true />
|
||||
Reference in New Issue
Block a user