diff --git a/core/src/main/resources/template/simple/a-close.ftl b/core/src/main/resources/template/simple/a-close.ftl index 4cacaf5ed..1c808e18b 100644 --- a/core/src/main/resources/template/simple/a-close.ftl +++ b/core/src/main/resources/template/simple/a-close.ftl @@ -25,6 +25,9 @@ <#if parameters.href??> href="${parameters.href?no_esc}"<#rt/> +<#if parameters.disabled!false> + disabled="disabled"<#rt/> + <#if parameters.tabindex??> tabindex="${parameters.tabindex}"<#rt/> diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java index 7c3f80d71..9e45ed7a7 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java @@ -276,6 +276,23 @@ public class AnchorTest extends AbstractUITagTest { verifyResource("href-5.txt"); } + public void testSimpleDisabled() throws Exception { + createAction(); + + AnchorTag tag = createTag(); + tag.setHref("a"); + tag.setDisabled("true"); + + StrutsBodyContent body = new StrutsBodyContent(null); + body.print("should have disabled attribute"); + tag.setBodyContent(body); + + tag.doStartTag(); + tag.doEndTag(); + + verifyResource("href-6.txt"); + } + public void testInjectEscapeHtmlBodyFlag() throws Exception { // given initDispatcherWithConfigs("struts-default.xml, struts-escape-body.xml"); diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-6.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-6.txt new file mode 100644 index 000000000..1e75ca9aa --- /dev/null +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-6.txt @@ -0,0 +1 @@ +should have disabled attribute \ No newline at end of file