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

A problem on Iterator tag

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.15
    • Fix Version/s: 2.5
    • Component/s: Other
    • Labels:
      None

      Description

      I can't explain well so see below.

      Expected "1, 2, , 3," but the result was "1, 2, 2, 3,".

      Test.jsp

      <s:iterator value="%{{{1, 2},{null, 3}}}" var="var1">
      <s:iterator value="#var1" var="var2">
      <s:property value="#var2" />,
      </s:iterator>
      </s:iterator>
      

      I changed below class then it was fixed.

      org.apache.struts2.components.IteratorComponent#start

      //  if ((var != null) && (currentValue != null)) { <= Old.
          if (var != null) { // <= New.
              //pageContext.setAttribute(id, currentValue);
              //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE);
              putInContext(currentValue);
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                OSSUser.K K OSSUser
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: