This post helps you understand the <fn:toLowerCase> tag in the JSTL function tags library with code example.

The fn:toLowerCase function converts all the characters of a given string to lower case.

 

JSTL <fn:toLowerCase> Syntax:

${fn.toLowerCase(<string or var>)}

 

JSTL <fn:toLowerCase> Example:

The following code snippet converts all the upper case characters to lower case.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>fn:toLowerCase Demo</title>
  </head>
  <body>
    <h1>fn:toLowerCase Demo</h1>
    <c:set var="text" value="CODEJAVA.NET IS GREAT SOURCE OF INFORMATION"/>
    Text before conversion:  <c:out value="${text}"/><br/><br/>
    <c:set var="text" value="${fn:toLowerCase(text)}"/>
    Text after conversion:  <c:out value="${text}"/><br/><br/>
  </body>
</html>

 

Output:

JSTL function fn-toLowerCase

 

Other JSTL Function Tags:

contains  |  containsIgnoreCase  |  endsWith |  escapeXml  |  indexOf  |  join  |  length  |  replace  |  split  |  startsWith  |  substring  |  substringAfter  |  substringBefore  |  toUpperCase  |  trim


About the Author:

is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.



Add comment