You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by K OSSUser <os...@gmail.com> on 2014/03/14 10:57:08 UTC
A problem on Iterator tag.
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
Re: A problem on Iterator tag.
Posted by Lukasz Lenart <lu...@apache.org>.
Great! Fill a JIRA ticket with the patch!
2014-03-14 10:57 GMT+01:00 K OSSUser <os...@gmail.com>:
> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org