Friday, August 04, 2006

how to do i find out the length of this arraylist using JSTL tags...





or if

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
${fn:length(theList)}

how to do i find out the length of this arraylist
using JSTL tags...

/That depends on what version of what server (and JSTL) you are using. If you are using JSTL 1.1 (JSP 2.0 server like Tomcat 5.0) then you can use:



If you are Using JSTL 1.0 and a JSP 1.2 server (like Tomcat 4), then you will either have to use a scriptlet, or run a c:forEach:

//scriptlet
<%
List array = (List)request.getAttribute("array");
Integer count = new Integer(array.size());
pageContext.setAttribute("count", count);
%>
//c:forEach

3 comments:

de said...

Interesting Article

Java Training in CHennai | Online Java Training

Unknown said...

A single java code can be used for various platforms.There is a massive demand for java professionals.So,Get start your career in java field.Being a java developer would be the correct career choice.
Regards,
Java Training in chennai | Java course in chennai | JAVA J2EE Training in Chennai

Unknown said...

nice and grrea blog to read.... thanks for sharing

selenium training in chennai | selenium training institute in chennai | Android training in chennai | android training institute in chennai