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

Hidden fields silently drop 'label' attributes in Struts 2.3.20

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.20
    • Fix Version/s: 2.3.24
    • Component/s: Expression Language
    • Labels:
    • Environment:

      Freemarker 2.3.21

      Description

      Hidden fields (populated in a Freemarker template using <@s.hidden>) are silently dropping the 'label' attribute, as of Struts 2.3.20. Renaming the attribute to anything else works.

      We are using the s.hidden tag with a custom theme to display read-only fields on the page, and we make use of the label attribute.

      This change could be intended behavior for hidden fields, but it was not the case in 2.3.16.3, and I could not find anything in the changelog for 2.3.20.

        Issue Links

          Activity

          Show
          lukaszlenart Lukasz Lenart added a comment - Please see the linked issue and also that commit https://git-wip-us.apache.org/repos/asf?p=struts.git;a=commitdiff;h=d63deb9750a3d409be30414faaf76f5481a4417d;hp=aa744b811f9c41b80cc30ad6cf41ccaa75da5323
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Looks like this change must be reverted

          +    @Override
          +    public void evaluateParams() {
          +        super.evaluateParams();
          +        label = null;
          +        addParameter("label", null);
          +    }
          
          Show
          lukaszlenart Lukasz Lenart added a comment - Looks like this change must be reverted + @Override + public void evaluateParams() { + super .evaluateParams(); + label = null ; + addParameter( "label" , null ); + }
          Hide
          Michael Hintenaus Michael Hintenaus added a comment -

          We are extending from the xhtml theme and since struts 2.3.20 some of our layouts are destroyed.
          The reason is the new hardecoded tr and td tag in the hidden.ftl.
          I can't understand this change in bug 4297, because I can't find any other ftl with table specific markup.
          I think it was a dirty fix.

          Show
          Michael Hintenaus Michael Hintenaus added a comment - We are extending from the xhtml theme and since struts 2.3.20 some of our layouts are destroyed. The reason is the new hardecoded tr and td tag in the hidden.ftl. I can't understand this change in bug 4297, because I can't find any other ftl with table specific markup. I think it was a dirty fix.
          Hide
          thrawnca Mitth'raw'nuruodo added a comment -

          Does anyone know the reason for the original change? Should it be reverted, or is the answer simply "Don't do that"?

          I realise it's a bit odd to have a supposedly-hidden field causing elements to be displayed, but as I mentioned, we're using a custom theme, so it gets formatted the same way as our other fields, and it would be messy to re-create that formatting directly in the Freemarker template. Is there a field type designed for visible read-only output?

          Show
          thrawnca Mitth'raw'nuruodo added a comment - Does anyone know the reason for the original change? Should it be reverted, or is the answer simply "Don't do that"? I realise it's a bit odd to have a supposedly-hidden field causing elements to be displayed, but as I mentioned, we're using a custom theme, so it gets formatted the same way as our other fields, and it would be messy to re-create that formatting directly in the Freemarker template. Is there a field type designed for visible read-only output?
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Those hardcoded <tr/> and <td/> are needed to follow pattern of xhtml theme - without them we get issue mentioned in WW-4297. But as hidden.ftl from simple theme wasn't changed you can base on that. In the current version of Struts you can override any template you want - just put your own version in template/xhtml/hidden.ftl

          Show
          lukaszlenart Lukasz Lenart added a comment - Those hardcoded <tr/> and <td/> are needed to follow pattern of xhtml theme - without them we get issue mentioned in WW-4297 . But as hidden.ftl from simple theme wasn't changed you can base on that. In the current version of Struts you can override any template you want - just put your own version in template/xhtml/hidden.ftl
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Reason for the change you have in WW-4297 - the only mistake is the one I have put above with resetting the label attribute, that part must be reverted, the rest must stay.

          Show
          lukaszlenart Lukasz Lenart added a comment - Reason for the change you have in WW-4297 - the only mistake is the one I have put above with resetting the label attribute, that part must be reverted, the rest must stay.
          Hide
          Michael Hintenaus Michael Hintenaus added a comment -

          Yes, I know we already override the hidden.ftl to solve our problem

          Show
          Michael Hintenaus Michael Hintenaus added a comment - Yes, I know we already override the hidden.ftl to solve our problem
          Hide
          aleksandr-m Aleksandr Mashchenko added a comment -

          Maybe this (good) fix needs to be noted in release notes or somewhere.

          Show
          aleksandr-m Aleksandr Mashchenko added a comment - Maybe this (good) fix needs to be noted in release notes or somewhere.
          Hide
          lukaszlenart Lukasz Lenart added a comment - - edited

          Not sure what you mean - template inheritance was introduced in 2.3.16 (WW-4145, Extending Themes)

          Show
          lukaszlenart Lukasz Lenart added a comment - - edited Not sure what you mean - template inheritance was introduced in 2.3.16 ( WW-4145 , Extending Themes )
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 243378937969e5caeeeefc2bd98ce799a995e431 in struts's branch refs/heads/develop from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=2433789 ]

          WW-4447 Reverts some changes introduced by WW-4297
          Resetting 'label' attribute can block user if they would like to
          develop their own hidden.ftl template

          Show
          jira-bot ASF subversion and git services added a comment - Commit 243378937969e5caeeeefc2bd98ce799a995e431 in struts's branch refs/heads/develop from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=2433789 ] WW-4447 Reverts some changes introduced by WW-4297 Resetting 'label' attribute can block user if they would like to develop their own hidden.ftl template
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Reverted the mentioned change in Hidden.java

          Show
          lukaszlenart Lukasz Lenart added a comment - Reverted the mentioned change in Hidden.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Struts-JDK6-develop #123 (See https://builds.apache.org/job/Struts-JDK6-develop/123/)
          WW-4447 Reverts some changes introduced by WW-4297 (lukaszlenart: rev 243378937969e5caeeeefc2bd98ce799a995e431)

          • core/src/main/java/org/apache/struts2/components/Hidden.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Struts-JDK6-develop #123 (See https://builds.apache.org/job/Struts-JDK6-develop/123/ ) WW-4447 Reverts some changes introduced by WW-4297 (lukaszlenart: rev 243378937969e5caeeeefc2bd98ce799a995e431) core/src/main/java/org/apache/struts2/components/Hidden.java
          Hide
          aleksandr-m Aleksandr Mashchenko added a comment - - edited

          Was referring to WW-4297 which added <tr/> and <td/> around hidden inputs. I've updated an app recently to 2.3.20 and had to search why layout is broken after update. There isn't any mention of it in the release notes.

          Show
          aleksandr-m Aleksandr Mashchenko added a comment - - edited Was referring to WW-4297 which added <tr/> and <td/> around hidden inputs. I've updated an app recently to 2.3.20 and had to search why layout is broken after update. There isn't any mention of it in the release notes.
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          It's hard to predict what is important and what's not if you have over 140 issues resolved

          Done!
          https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.3.20

          Show
          lukaszlenart Lukasz Lenart added a comment - It's hard to predict what is important and what's not if you have over 140 issues resolved Done! https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.3.20
          Hide
          aleksandr-m Aleksandr Mashchenko added a comment -

          That's true. Thank you for updating the notes.

          Show
          aleksandr-m Aleksandr Mashchenko added a comment - That's true. Thank you for updating the notes.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Struts-JDK6-master #904 (See https://builds.apache.org/job/Struts-JDK6-master/904/)
          WW-4447 Reverts some changes introduced by WW-4297 (lukaszlenart: rev 243378937969e5caeeeefc2bd98ce799a995e431)

          • core/src/main/java/org/apache/struts2/components/Hidden.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Struts-JDK6-master #904 (See https://builds.apache.org/job/Struts-JDK6-master/904/ ) WW-4447 Reverts some changes introduced by WW-4297 (lukaszlenart: rev 243378937969e5caeeeefc2bd98ce799a995e431) core/src/main/java/org/apache/struts2/components/Hidden.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Struts-JDK7-master #371 (See https://builds.apache.org/job/Struts-JDK7-master/371/)
          WW-4447 Reverts some changes introduced by WW-4297 Resetting 'label' (lukaszlenart: rev 243378937969e5caeeeefc2bd98ce799a995e431)

          • core/src/main/java/org/apache/struts2/components/Hidden.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Struts-JDK7-master #371 (See https://builds.apache.org/job/Struts-JDK7-master/371/ ) WW-4447 Reverts some changes introduced by WW-4297 Resetting 'label' (lukaszlenart: rev 243378937969e5caeeeefc2bd98ce799a995e431) core/src/main/java/org/apache/struts2/components/Hidden.java

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              thrawnca Mitth'raw'nuruodo
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development