In this section we will read about JSTL. You will read about how it is implemented and used in JSP pages.
JSTL also known as Java Standard Tag Library is a collection of various tags for performing tasks like iteration, conditional checks, data formatting, localization etc. These tags are gathered as to perform the tasks that are commonly used in JSP applications. JSTL provides the feature for integrating the custom tags with JSTL tags. JSTL tags are classified on their use/purpose. These are as follows :
To use JSTL you would have to first download the JSTL JARs. Then it should be kept inside the lib folder in the web server/application server.
JSTL Core Tags
JSTL Core Tags are used for manipulating with the data in JSP pages. Such as, iterating on data collection, set an output, apply the conditional statements, set the parameter etc.
To use the JSTL Core Tags you would have to use the following taglib
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Followings are the commonly used tags of JSTL core tag library that are used in the JSP pages :
JSTL Formatting Tags
JSTL Formatting Tags are useful for the internationalization. Internationalization means formatting the text, date, time, numbers, etc. according to their localization. The JSTL format tag library provides many of the tags that are helpful in creation of internationalized websites.
To use the JSTL Formatting Tags you would have to use the following taglib :
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
Followings are the commonly used tags of JSTL format tag library :
JSTL SQL Tags
JSTL SQL Tags are useful to manipulate the database data in the JSP page. These tags helps in to interact with the Database for example, MySQL, Oracle, etc.
To use the JSTL SQL Tags you would have to use the following taglib :
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
Followings are the commonly used tags of JSTL sql tag library :
JSTL XML Tags
JSTL XML Tags are useful for manipulating the XML documents. This tag library allows the developer to interact with the XML data on JSP page for example, XML parsing, transform XML data, flow control based on XPath expressions.
To use the JSTL XML Tags you would have to use the following taglib :
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
When you want to work with the JSTL XML Tag libraries you would also have to keep the two additional XML and XPath related libraries inside the lib folder of the Tomcat Installation Directory.
Followings are the commonly used tags of JSTL XML tag library :
JSTL Functions library is the collection of functions that are provided to use. One can use these standard functions on the JSP pages while coding. Most of these provided functions are commonly used for string manipulation.
To use the JSTL functions you would have to use the following taglib :
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
Followings are the commonly used functions of JSTL functions :
To read more in detail about JSTL and Examples you may go through the following link : http://www.roseindia.net/jstl/index.shtml
Recommend the tutorial