Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5357

Struts anchor tag doesn't support "disabled" even though docs indicate it does

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.26
    • 6.4.0
    • Core Tags
    • None

    Description

      Hello there,

      When generating an anchor tag with the "disabled" attribute and the simple theme, struts does not seem to render it properly:

      <%@taglib prefix="s" uri="/struts-tags" %>
      
      ...
      
      <s:a action="myAction" cssClass="btn btn-default" disabled="true">
          <s:param name="myParam" value="#bean.Value"/>
          <s:text name="my.properties.key"/>
      </s:a>
      

      The generated link does not contain expected disabled="disabled".

      The value is described in the TLD and is documented on the site https://struts.apache.org/tag-developers/a-tag :

          <attribute>
            <description><![CDATA[Set the html disabled attribute on rendered html element]]></description>
            <name>disabled</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
          </attribute>
      

      It looks like it's missing from the .ftl file? I added it manually as a work-around with an overridden template, but perhaps I missed something. We are admittedly on an old version of struts but I didn't see any differences in the current version of the git repo.

      <#if parameters.disabled!false>
       disabled="disabled"<#rt/>
      </#if>
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mikehum1 Michael Hum
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h