JSTL Function fn:toUpperCase Example
- Details
- Written by Nam Ha Minh
- Last Updated on 30 August 2019   |   Print Email
This post helps you understand how to use the <fn:toUpperCase> tag in the JSTL function tags library with code example.
The fn:toUpperCase function converts all the characters of a given string to upper case.
JSTL <fn:toUpperCase> Syntax:
${fn.toUpperCase(<string or var>)}
JSTL <fn:toUpperCase> Example:
The following code snippet converts all the lower case characters to upper 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:toUpperCase Demo</title> </head> <body> <h1>fn:toUpperCase 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:toUpperCase(text)}"/> Text after conversion: <c:out value="${text}"/><br/><br/> </body> </html>
Output:
Other JSTL Function Tags:
contains | containsIgnoreCase | endsWith | escapeXml | indexOf | join | length | replace | split | startsWith | substring | substringAfter | substringBefore | toLowercase | trim
Comments