Example of fn:toUpperCase() Function

In this example, we will discuss the use of fn:toUpperCase() in a JSP page.

HTML




<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
  
<html>
  <head>
      <title>JSTL fn:toUpperCase() Example</title>
  </head>
  <body>
    <c:set var="inputString" value="w3wiki"/>
    <h3>Original String: ${inputString}</h3>
      
    <p>Uppercase String: ${fn:toUpperCase(inputString)}</p>
      
  </body>
</html>


Output:

Original String: w3wiki
Uppercase String: w3wiki

Output Screen of fn:toUpperCase() Function:

Explanation of the above Program:

  • inputString initialized with the value “w3wiki” using c:set
  • Then, we print or display this inputString in <h3> tag of HTML.
  • the function of fn:toUpperCase() we are transforming the inputString characters into uppercase, which becomes “w3wiki“.
  • Lastly, we are displaying this converted output using the <p> tag of HTML.

JSTL fn:toUpperCase() Function

In JSTL, the fn:toUpperCase() function is used to transform all the characters in a specified string to uppercase. If the input string is in lowercase, then this function can convert all the characters into uppercase.

In this article, we will see the Syntax along with Parameters and detailed implementation of JSTL fn:toUpperCase() Function in terms of example.

Syntax of fn:toUpperCase() Function

${fn:toUpperCase(string)}

Where,

  • ${fn:toUpperCase()}: This is the expression used to convert the input string into the characters of Uppercase.
  • string: This is the input string to be converted into the uppercase characters.

Similar Reads

Example of fn:toUpperCase() Function

In this example, we will discuss the use of fn:toUpperCase() in a JSP page....

Contact Us