|
|
fn:length tag of Function Tag Library
|
Tutorials

Jsp

|
Topic |
What is "fn:length" tag of Function Tag Library?
|
|
Explanation |
|
"fn:length" is a string function of JSP Standard Tag Library(JSTL).This string function is used to return the number of elements from an array
or a collection, characters from a string.
Syntax:
int:fn:length(value)
In the above syntax the "value" can be of any data type.
Example:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
<html>
<form>
<p>Enter your new username:<input type="text" name="usr" size="25">
<input type="submit" value="Submit">
</form>
<br>
Length of your username is::
<c:out value="${fn:length(param.usr)}" />
</html>
In the above example the length of the username is displayed when the form is submitted by getting the attribute
value using "param.usr" for the text box.
|
|
A Note |
|
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.
|
|
|
|