Share on Google+Share on Google+

The fn:toUpperCase & fn:toLowerCase tags of JSTL

In this section ,we will learn how to use fn:toUpperCase and fn:toLowerCase Tag of JSTL.

The fn:toUpperCase & fn:toLowerCase tags of JSTL

In this section ,we will learn how to use fn:toUpperCase and  fn:toLowerCase Tag of JSTL. These tags are used to change case of specified string to upper or lower. This takes string type as argument.


In this Example, the user enters the value of string, which he wants to change it's case(i.e lowercase or uppercase). The c:if tag of JSTL checks whether requirement is 'uppercase' or' lowercase' & convert it accordingly using  "fn:toUpperCase()" or " fn:toLowerCase()" method of JSTL.


<%@ taglib uri="" prefix="fn" %>

<%@ taglib uri="" prefix="c" %>



<title>Example of 'fn:toUpperCase' and 'fn:toLowerCase' tag of jstl</title>


<body bgcolor="grey">

<form method="POST">

Enter String here and select case as per your choice.



<td>Enter String</td>

<td><input type="text" name="string"></td>




<td><input type="radio" name="case" value="upper"> Upper Case

<input type="radio" name="case" value="lower"> Lower Case </td>




<td><input type="submit" value="change"></td>




<c:if test="${pageContext.request.method=='POST'}">

<c:set var="string" value="${param.string}"/>

<font size="5" color="green">

<c:if test="${'upper'}">

<c:out value="${fn:toUpperCase(string)}"/>


<c:if test="${'lower'}">

<c:out value="${fn:toLowerCase(string)}"/>







After submitting Value the output will be :

Download Source Code


Posted on: July 3, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null