Table of Contents:

        1.Core Tags

        2.Formatting Tags

        3.SQL Tags

        4.XML Tags

        5.JSTL Tag Reference Sample Application

        6.Download Eclipse project/WAR file

 

A comprehensive reference of JSTL tags:

The following sections discuss in details the four types of tag libraries along with examples which are applicable. Please click on each tag to access information about tag usage and working examples.

 

JSTL Core Tags:

 

To use core tags in the JSP specify the following directive at the beginning of the JSP.

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

JSTL Formatting Tags:

 

To use formatting tags in the JSP specify the following directive at the beginning of the JSP.

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

JSTL SQL Tags:

 

To use the SQL tags in the JSP specify the following directive at the beginning of the JSP.

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

JSTL XML Tags:

 

<x:choose>

 

 

<x:forEach>

 

<x:if>

 

<x:otherwise>

 

<x:parse>

 

 

<x:set>

 

<x:transform>

 

<x:when>

 

<x:out>

 

<x:param>

 


 

 
 

To use the XML tags in the JSP specify the following directive at the beginning of the JSP.

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

JSTL Tag Reference - Sample Application:

The sample Eclipse project contains the working examples for all the four types of JSTL tags. The Eclipse project structure is shown below:

eclipse-project-structure

The project’s starting point is /JSTL-Reference/jstl-tag-reference.jsp. If you’ve deployed this web application in your local Tomcat, the URL to access the JSTL Reference web application is:

http://localhost:8080/JSTL-Tag-Reference/jstl-tag-reference.jsp

 

The Employee.sql contains the database table script used in this project.

jstl-tag-reference

Once you deployed the WAR file to the server, please click on respective tag type to access the full table of contents for each tag type selected. The four following screen captures display each tag type access pages and their respective tags.

core-tag-reference

 

JSTL Core Tags - http://localhost:8080/JSTL-Tag-Reference/tag-types/core-tag-reference.jsp

format-tag-reference

 

JSTL Formatting Tags - http://localhost:8080/JSTL-Tag-Reference/tag-types/formatting-tag-reference.jsp

sql-tag-reference

 

JSTL SQL Tags - http://localhost:8080/JSTL-Tag-Reference/tag-types/sql-tag-reference.jsp

 

[Please ensure the database server is up and running when accessing JSTL SQL tags].

xml-tag-reference

 

JSTL XML Tags - http://localhost:8080/JSTL-Tag-Reference/tag-types/xml-tag-reference.jsp

 

Download Eclipse Project / WAR file

 Please download Eclipse project and deployable .war file in the attachments 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.



Attachments:
Download this file (JSTL-Tag-Reference.war)JSTL-Tag-Reference WAR File[This .war file is deployable to access working examples from this article.]4039 kB
Download this file (JSTL-Tag-Reference.zip)JSTL Tag Reference Eclipse Project[This Eclipse project can be readily imported into Eclipse environment.]4048 kB

Add comment