You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Espen Nicolaisen <es...@hotmail.com> on 2005/07/10 18:44:42 UTC
logic:iterate Get last element of a list
When I'm iterating through a list I want to check the last element. I want
to use bean:size and indexId which I declare in logic:iterate. Since the
index declarered in logic:iterate starts on zero I must check on
<logic:equal name="listSize" value="index-1">
How do I subtract 1 from index?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: logic:iterate Get last element of a list
Posted by ichy <ic...@gmail.com>.
hi, Espen.
you need to use scriptlet for the calculation.
you can do something like
<logic:equal name="listSize" value="<%= String.valueOf( index.intValue() -
1 ) %>">
i hope this will help you.
ichy
2005/7/11, Espen Nicolaisen <es...@hotmail.com>:
>
> When I'm iterating through a list I want to check the last element. I want
> to use bean:size and indexId which I declare in logic:iterate. Since the
> index declarered in logic:iterate starts on zero I must check on
> <logic:equal name="listSize" value="index-1">
>
> How do I subtract 1 from index?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>