struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From K OSSUser <ossue...@gmail.com>
Subject A problem on Iterator tag.
Date Fri, 14 Mar 2014 09:57:08 GMT
Hi,

I'm using Struts2.3.15 and I had a problem then tested a simple jsp.

I 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);
    }
-------------------------------------------------------------------

I hope, this will be useful.

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message