Table of Contents:

  1. Introduction to JSTL Functions
  2. JSTL Functions Reference and Examples
  3. Sample Project – JSTL-Functions-Reference Structure
  4. Downloads
 

Introduction to JSTL Functions

JSTL Functions allow to do common tasks like searching for a string in another string, checking whether a particular string starts or ends with a specified string or finding out an index of a string within another string etc. To use JSTL Functions we need to include JSTL Functions tag library in our JSP as shown below:

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

The following section discusses about JSTL Functions in details along with working examples.

 

JSTL Functions Reference and Examples

fn:contains

fn:containsIgnoreCase

fn:endsWith

fn:escapeXml

fn:indexOf

fn:join

fn:length

fn:replace

fn:split

fn:startsWith

fn:substring

fn:substringAfter

fn:substringBefore

fn:toLowerCase

fn:toUpperCase

fn:trim

 

Sample Project – JSTL-Functions-Reference Structure

The sample Eclipse project contains all the working code examples from this article. If you have downloaded and deployed the JSTL-Functions-Reference .war file, the starting point would have been index.jsp. You can access the index.jsp by the URL http://localhost:8080/JSTL-Functions-Reference/index.jsp assuming you’ve deployed the .war file to a container like Tomcat.

JSTL functions index page

Once the web application is deployed, up and running, you can click on each link to see the working example of the individual JSTL functions. 

All the JSP files demonstrating JSTL functions are organized into the folder jstl-functions. The project structure is shown below:

JSTL functions project structure

Downloads:

Please download the Eclipse sample project with working code examples and deployable .war file from the downloads section.



 

Other JSTL Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.



Add comment

   


Comments 

#1surajit sarkar2020-10-10 09:56
Type Exception Report

Message An exception occurred processing [default.jsp] at line [21]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception
org.apache.jasper.JasperException: An exception occurred processing [default.jsp] at line [21]

18: url="http://localhost:8080/first/citizen-template.xsl" var="xsltTemplate"/>
19:
21:
22:
23:
Quote