user2470075
user2470075

Reputation: 169

<JSP> What is purpose of using " ${fn:....} "?

I have a code as following

<c:forEach begin="2013" end="${fn:substring(maps.curDate,0,4)}" step="1" var="yearList">

I know they use substr in SQL.

1) What does " ${fn:substring(maps.curDate,0,4)} " mean in this code?

2) What do they use "${fn: ... " and what does it mean?

Upvotes: 0

Views: 899

Answers (1)

Vidya
Vidya

Reputation: 30310

The fn is the conventional prefix for the JSTL Function Tag Library, which provides a set of functions that can be used with the JSP Expression Language.

The prefix is defined this way:

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

In the case of ${fn:substring(maps.curDate,0,4)}, this calls the Function Tag Library substring function, which takes the string parameter and returns a piece of it as defined by the indices provided. In the example, it returns the first four characters of maps.curDate as shown here.

Upvotes: 2

Related Questions