Name

fn:length

Synopsis

This function returns the number of characters in a string or the number of elements in a collection. It returns 0 if the value is null.

Syntax

int: fn:length(value)

Parameters

Parameter name

Java type

Description

value

Any type that can be used as a <c:forEach> items attribute value, or String.

The string or collection to measure.

Example

There are ${fn:length(collection)} items in this collection.

Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.