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
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

JSP Standard Tag Library of JSP

Tutorials Jsp


How is JSP Standard Tag Library used in JSP?


JSP Standard Tag Library (JSTL) was introduced to ease the programming in JSP by storing generic tasks in tag libraries under four different categories based on conditional processing and looping, XML processing, Internationalization and formatting, database access and a set of expression language functions.

   <%@ taglib uri="URIToTagLibrary" prefix="tagPrefix" %>

In the above example the "uri" points to the tag library "matlib.tld", the prefix used in the taglib directive as well as in the coding is same that is "mtaglib".

The following table lists the URI for the JSTL 1.1 libraries.

Library URI Prefix
Core c
XML Processing x
l18N formatting fmt
Database access sql
Functions fn
    <%@ taglib uri="" 
    prefix="c" %>
    <%@ taglib uri="" 
    prefix="fn" %>
    <head><title>JSTL Functions</title></head>
    USERNAME:<input type="text" name="usr" size="25">
    <input type="submit" value="Submit">
    <input type="reset" value="Reset">
    Length of your Username is::
    <c:out value="${fn:length(param.usr)}" />

In the above example first taglib directive points to the JSTL core tag library with prefix "c". So the "<c:out" statement works fine. For the functions like "${fn:length(param.usr)}" that can be invoked using the JSP Expression Language we include the JSTL function library with prefix "fn". The above example outputs the length of the username entered.

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