There is a bean:size tag that could help with this. 

But, it's possible that you might want to put any logic this complex
into the object as a helper method. The object you are iterating should
be able to tell you whether it is the last item or not and return that
as a simple value you can test. 

Placing helper method on objects to help with presentation issues is a
standard J2EE pattern, so don't be afraid to use it.

Though, in most cases, you can just write whatever it is after the
iterate completes, since it always ends after the last item. 

It may be that you want to present the markup one way when there is one
item, and another way when there is more than item. 

The bean:size tag can help with this, though personally I use helper
methods that tell me whether my result object is empty or not (and so
forth). The presentation page should be as dumb as possible, since there
is enough going on there already. 

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


"Mannem, Taati" wrote:
> 
> Guys,
>         When I iterate thru <logic:iterator> how do I know that I am in the
> last element?
> I have tried using some other way like getting the index and comparing but
> it doesnt seem to work..
> The reason why I want to do this
> 
> if I am in the last element I need to print something and if I am not then I
> dont have to print.
> Thanks in advance.
> 
> Regards,
> Taati
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to