tumblr counter

JSTL Functions

JSTL Functions Example explains about using different functions available in JSTL Taglib

To perform string functions in JSP without using any java code inside JSP, we can use JSTL functions. For this we need to prefix fn allows us to perform string functions in JSP

For working with JSTL functions, we need to import following additional taglib url

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

to our jsp, please check the below example code

 

Required Libraries

You need to download

  1. Tomcat 7
  2. JSTL 1.2

Following jar must be in classpath

  1. jstl-1.2.jar

JSTL Functions

JSTL have the following utility functions and String functions available

fn:contains()Testing if an input string contains the specified substring.
fn:containsIgnoreCase()Testing if an input string contains the specified substring in a case insensitive way.
fn:endsWith()Testing if an input string ends with the specified suffix.
fn:escapeXml()Escaping characters that could be interpreted as XML markup.
fn:indexOf()Returning the index within a string of the first occurrence of a specified substring.
fn:join()Joining all elements of an array into a string.
fn:length()Returning the number of items in a collection, or the number of characters in a string.
fn:replace()Returning a string resulting from replacing in an input string all occurrences of a "before" string into an "after" substring.
fn:split()Splits a string into an array of substrings.
fn:startsWith()Testing if an input string starts with the specified prefix.
fn:substring()Returning a subset of a string.
fn:substringAfter()Returning a subset of a string following a specific substring.
fn:substringBefore()Returning a subset of a string before a specific substring.
fn:toLowerCase()Converting all of the characters of a string to lower case.
fn:toUpperCase()Converting all of the characters of a string to upper case.
fn:trim()Removing white spaces from both ends of a string.

 




JSTL Functions Example JSTL Core Functions JSTL El Functions JSTL Function In JSP

You might also like following tutorials :

Java Tutorial Apache CXF Tutorial Hibernate Tutorial Spring Tutorial Struts Tutorial
0 Comments on "JSTL Functions"