Struts 2
  1. Struts 2
  2. WW-3804

tag s:radio does not support dynamic attributes

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.3
    • Fix Version/s: 2.3.7
    • Component/s: Plugin - Tags
    • Labels:

      Description

      The tag s:radio does not support dynamic attributes. As a result, integration with javascript frameworks like Dojo does not work (it's not possible to setup the attribute dojoType or data-dojo-type)

        Activity

        Hide
        Lukasz Lenart added a comment -

        Any specific needs ? I've added dynamic attributes support for s:radio tag and changed a bit logic for value to use ValueStack to look for a value or the use original value.

        Show
        Lukasz Lenart added a comment - Any specific needs ? I've added dynamic attributes support for s:radio tag and changed a bit logic for value to use ValueStack to look for a value or the use original value.
        Hide
        Jose L Martinez-Avial added a comment -

        well, just a quick question. When using HTML5 attributes (like data-dojo-props), would it be possible to use OGNL expression inside the value of the attribute. For example:

        <s:radio name="myRadio" list"myRadioList" data-dojo-type="dijit.form.RadioButton" data-dojo-props="checked: %

        {isChecked};"/>

        where %{isChecked}

        would be resovled against the vs. So, basically, it is possible to mix strings and ognl expression on the value?

        Show
        Jose L Martinez-Avial added a comment - well, just a quick question. When using HTML5 attributes (like data-dojo-props), would it be possible to use OGNL expression inside the value of the attribute. For example: <s:radio name="myRadio" list"myRadioList" data-dojo-type="dijit.form.RadioButton" data-dojo-props="checked: % {isChecked};"/> where %{isChecked} would be resovled against the vs. So, basically, it is possible to mix strings and ognl expression on the value?
        Hide
        Lukasz Lenart added a comment -

        Done, solved! Thanks for reporting!

        Added also support for expressions in values of dynamic attributes

        https://cwiki.apache.org/confluence/display/WW/Freemarker+Support

        Show
        Lukasz Lenart added a comment - Done, solved! Thanks for reporting! Added also support for expressions in values of dynamic attributes https://cwiki.apache.org/confluence/display/WW/Freemarker+Support
        Hide
        Hudson added a comment -

        Integrated in Struts2 #461 (See https://builds.apache.org/job/Struts2/461/)
        WW-3804 adds support of dynamic attributes to <s:radio/> tag and extends support for dynamic attributes with expression evaluation (Revision 1328526)

        Result = SUCCESS
        lukaszlenart :
        Files :

        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
        • /struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl
        • /struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl
        • /struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java
        • /struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
        • /struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-7.txt
        Show
        Hudson added a comment - Integrated in Struts2 #461 (See https://builds.apache.org/job/Struts2/461/ ) WW-3804 adds support of dynamic attributes to <s:radio/> tag and extends support for dynamic attributes with expression evaluation (Revision 1328526) Result = SUCCESS lukaszlenart : Files : /struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java /struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl /struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl /struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java /struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java /struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-7.txt
        Hide
        Jon Moores added a comment -

        After downloading 2.3.4 this doesnt appear to be fixed. Did it make it to the 2.3.4 release ?

        Show
        Jon Moores added a comment - After downloading 2.3.4 this doesnt appear to be fixed. Did it make it to the 2.3.4 release ?
        Show
        Lukasz Lenart added a comment - Are you sure ? Check the test case http://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java https://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-7.txt
        Hide
        Jon Moores added a comment -

        I havent run the test locally but I updated my struts jars to the new version and added the html below to my page:

        <tr>
        <td class="tdLabel"><label for="myname" class="label">mylabel:</label></td>
        <td>
        <s:radio name="myname" id="mynamehello" value="hello" list="#

        {'ALL': 'All Instructions'}

        " dojo="checked:hello"/><label for="mynamehello">world</label>
        <s:radio name="myname" id="mynamefoo" list="#

        {'ALL': 'All Instructions'}

        " value="foo" dojo="checked:foo"/><label for="mynamefoo">bar</label>
        </td>
        </tr>

        and I get the error. Also the docs for 2.3.4 explicitly say 'dynamic attributes allowed: false'

        Error Message:
        JSPG0227E: Exception caught while translating /tradingCentre/fund_orders.jsp: /tradingCentre/fund_orders.jsp(54,9) --> JSPG0123E: Unable to locate tag attribute info for tag attribute dojo.

        Show
        Jon Moores added a comment - I havent run the test locally but I updated my struts jars to the new version and added the html below to my page: <tr> <td class="tdLabel"><label for="myname" class="label">mylabel:</label></td> <td> <s:radio name="myname" id="mynamehello" value="hello" list="# {'ALL': 'All Instructions'} " dojo="checked:hello"/><label for="mynamehello">world</label> <s:radio name="myname" id="mynamefoo" list="# {'ALL': 'All Instructions'} " value="foo" dojo="checked:foo"/><label for="mynamefoo">bar</label> </td> </tr> and I get the error. Also the docs for 2.3.4 explicitly say 'dynamic attributes allowed: false' Error Message: JSPG0227E: Exception caught while translating /tradingCentre/fund_orders.jsp: /tradingCentre/fund_orders.jsp(54,9) --> JSPG0123E: Unable to locate tag attribute info for tag attribute dojo.
        Hide
        Lukasz Lenart added a comment -

        Solved, thanks for reporting!

        Show
        Lukasz Lenart added a comment - Solved, thanks for reporting!
        Hide
        Hudson added a comment -

        Integrated in Struts2 #504 (See https://builds.apache.org/job/Struts2/504/)
        WW-3804 enables Radio tag to use dynamic attributes (Revision 1364090)

        Result = FAILURE
        lukaszlenart :
        Files :

        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Head.java
        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Radio.java
        • /struts/struts2/trunk/core/src/site/resources/tags/head.html
        • /struts/struts2/trunk/core/src/site/resources/tags/radio.html
        Show
        Hudson added a comment - Integrated in Struts2 #504 (See https://builds.apache.org/job/Struts2/504/ ) WW-3804 enables Radio tag to use dynamic attributes (Revision 1364090) Result = FAILURE lukaszlenart : Files : /struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Head.java /struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Radio.java /struts/struts2/trunk/core/src/site/resources/tags/head.html /struts/struts2/trunk/core/src/site/resources/tags/radio.html

          People

          • Assignee:
            Lukasz Lenart
            Reporter:
            Jose L Martinez-Avial
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development