I have the following code under javascript <script></script>
:
<c:forEach items="${lifeEvents}" var="event" varStatus="loop">
latitudes["${loop.index}"] = <c:out value="${event.place.location.latitude}"/>;
longitudes["${loop.index}"] = <c:out value="${event.place.location.longitude}"/>;
lastEvent = "${loop.index}";
if("${loop.index}" > 0)
waypointEvents["${loop.index}"] = new google.maps.LatLng(latitudes["${loop.index}"],longitudes["${loop.index}"]);
</c:forEach>
How can i know the exact number of LifeEvents that exist in the lifeEvents list? prior to running the entire loop untill the end ofc
If your lifeEvents is a collection, then you can get the size of the collection using jstl fn:length
<c:out value="${fn:length(lifeEvents)}" /> <%-- size of liveEvents --%>
Make sure you have added the following taglib at the top of your page to allow the fn namespace.
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With