diff --git a/core/src/main/resources/template/simple/hidden.ftl b/core/src/main/resources/template/simple/hidden.ftl index e22eda75e..3a6d38f2a 100644 --- a/core/src/main/resources/template/simple/hidden.ftl +++ b/core/src/main/resources/template/simple/hidden.ftl @@ -34,5 +34,8 @@ <#if parameters.cssStyle?exists> style="${parameters.cssStyle?html}"<#rt/> +<#if parameters.disabled?default(false)> + disabled="disabled"<#rt/> + <#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> \ No newline at end of file diff --git a/core/src/site/resources/tags/hidden.html b/core/src/site/resources/tags/hidden.html index 3e3b7c563..0239180fc 100644 --- a/core/src/site/resources/tags/hidden.html +++ b/core/src/site/resources/tags/hidden.html @@ -113,7 +113,7 @@ Please do not edit it directly. : false String - String that will be appended to the labe + String that will be appended to the label labelposition diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java index 9406da834..ea34dcce3 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java @@ -48,6 +48,23 @@ public class HiddenTest extends AbstractUITagTest { verify(TextFieldTag.class.getResource("Hidden-1.txt")); } + public void testDisabled() throws Exception { + TestAction testAction = (TestAction) action; + testAction.setFoo("bar"); + + HiddenTag tag = new HiddenTag(); + tag.setPageContext(pageContext); + tag.setLabel("mylabel"); + tag.setName("myname"); + tag.setValue("%{foo}"); + tag.setDisabled("true"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(TextFieldTag.class.getResource("Hidden-2.txt")); + } + /** * Initialize a map of {@link org.apache.struts2.views.jsp.AbstractUITagTest.PropertyHolder} for generic tag * property testing. Will be used when calling {@link #verifyGenericProperties(org.apache.struts2.views.jsp.ui.AbstractUITag, diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt new file mode 100644 index 000000000..2cc5ab6c7 --- /dev/null +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt @@ -0,0 +1 @@ +