equivalent code for <% break; %> in JSTL....... ?

Hi,Does anyone know the JSTL equivalent of break; to break out of a loop?My requirement:I have to loop through a collection of objects. If a condition is satisfied, I need to set the values and break out of the loop.P.S: Scriptlet <% break; %> doesn抰
[297 byte] By [rageetha] at [2007-11-26 18:55:18]
# 1

There is currently no equivilant to 'break' in JSTL. You have several alternatives:

1) within your <c:forEach>, set a flag variable that is set when your 'break' condition occurs. Only process items before this flag is set. The obvious drawback to this is that you will continue to iterate over a Collection when there is no work to do. If your collections are small, this shouldn't be *too* bad of an idea.

2) Have your model/controller prune the collection before it gets to your JSP.This way, the collection is guaranteed to only contain items that you are concerned with processing.

bckrispia at 2007-7-9 20:33:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...