Javaserver Pages





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Tutorial
Introduction Introduction
Installing JDK-Windows Installing JDK-Windows
Installing JDK-Linux Installing JDK-Linux
Installing Tomcat Installing Tomcat
Simple Program in JSP Simple Program in JSP
Pre-defined Variables Pre-defined Variables
Syntax of Tags Syntax of Tags
JSP Expression Language JSP Expression Language
JSP EL Operators JSP EL Operators
EL Implicit Variables EL Implicit Variables
Scopes Scopes
Using Arrays Using Arrays
Methods Methods
JSP Elements JSP Elements
Including Beans Including Beans
JSTL Tags JSTL Tags
Custom Tags Custom Tags
Session Session in JSP
Handling Cookies Handling Cookies
JSP Application Structure JSP Application Structure
Configuring web.xml Configuring web.xml
Tomcat Configuration Tomcat Configuration
JSP Examples JSP Examples
Forums Ask Your Doubts
Feedback Feedback
 




fn:substring tag of Function Tag Library


Tutorials Jsp

Topic

What is "fn:substring" tag of Function Tag Library?



Explanation

"fn:substring" is a function of JSP Standard Tag Library(JSTL). This function is used to extract a string specified using the two index values "begin" and "end". If the index values is less than "0" the function takes it as "0", if more than the length of the string the function returns an empty string. Otherwise displays the values between "begin" and "end".

Syntax:
     String:fn:substring(string,begin,end)

In the above syntax the "string" is of Data type "String", "begin" and "end" is of data type "int".

Example:
   <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" 
   prefix="fn" %>
   <p><b>Extract 'tree' from 'trees'::</b></p>
   ${fn:substring('trees',0,4)}
Result
    Extract 'tree' from 'trees'::
    tree 

In the above example we have extracted the substring "tree" from the string "trees" by giving the begining value to "0", ending value "4".




A Note
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.


Other Links

web hosting