

{"id":81369,"date":"2020-09-01T09:00:39","date_gmt":"2020-09-01T03:30:39","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=81369"},"modified":"2021-08-25T13:47:21","modified_gmt":"2021-08-25T08:17:21","slug":"jsp-standard-tag-library-jstl","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/","title":{"rendered":"JSP Standard Tag Library Tutorial"},"content":{"rendered":"<p>Welcome to DataFlair JST Tutorial. This article discusses the JSTL, i.e., Standard Tag Library of JSP. It discusses the tags and functions present in it in detail. So let&#8217;s see JSP Standard tag Library in detail.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-81438 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg\" alt=\"JSP Standard Tag Library\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<h2>JSP Standard Tag Library Introduction<\/h2>\n<p>There are different tags in JSP. The Standard Tag Library of JSP, known as JSTL, is a collection of JSP tags. JSTL supports tasks that are common or structural in nature. They are iteration and conditionals, tags that stimulate internationalization tags, XML documents, and SQL tags. It integrates custom tags too.<\/p>\n<p>To use them, we need to firstly install them. So let&#8217;s learn JSTL Installation.<\/p>\n<h3>How to Install JSTL Library<\/h3>\n<p>For apache tomcat-users, the following is the approach for JSTL Installation:<\/p>\n<ul>\n<li>Download and unpack the compressed file of Apache Standard Taglib.<\/li>\n<li>Copy the jar files into the lib folder to the destination: webapps\\ROOT\\WEB-INF\\lib directory<br \/>\n&lt;taglib&gt; directive include these tags.<\/li>\n<\/ul>\n<h3>JSTL tags and their classification<\/h3>\n<p>JSTL is a standard library tag used to implement functionalities in JSP programs. They classify under tag library groups based on their functionality. They are:<\/p>\n<ul>\n<li>Core Tags<\/li>\n<li>Formatting tags<\/li>\n<li>SQL tags<\/li>\n<li>XML tags<\/li>\n<li>JSTL Functions<\/li>\n<\/ul>\n<h3>JSTL Core Tags<\/h3>\n<p>They are the most important and most used tags among the JSTL tags.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ taglib prefix = \"c\" uri = \"http:\/\/www.mysun.com\/jsp\/jstl\/core\" %&gt;\r\n<\/pre>\n<p>Core tags in JSTL are as follows:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>S.No.<\/b><\/td>\n<td><b>Tag<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:out&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is Similar to the &lt;%=___&gt; that are meant for expression statements.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:set &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will set the scope for the result that we get from expression evaluation.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:remove &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will remove the variable. It will remove the particular variable from scope if defined.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:catch&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag catches the Throwable exceptions in the section it is defined.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">5<\/span><\/td>\n<td>&lt;c:if&gt;<\/td>\n<td><span style=\"font-weight: 400\">This tag will evaluate its body section if the condition specified is true. It is a conditional tag.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:choose&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is implacable when there are conditional operations that are mutually exclusive. This tag is used with &lt;when&gt; and &lt;otherwise&gt; tags.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">7<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:when&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is a subtag of <\/span><b>&lt;choose&gt;<\/b><span style=\"font-weight: 400\"> that is discussed above. If the condition specified is true, then only this tag will include the body section.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">8<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:otherwise &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This is also a subtag of &lt;choose&gt; tag. If the condition becomes false, then this part runs that follows the section.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">9<\/span><\/td>\n<td>&lt;c:import&gt;<\/td>\n<td><span style=\"font-weight: 400\">This tag will import the url.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">10<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:forEach &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This is an iteration tag that supports the subsetting of elements of different types.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">11<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:forTokens&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will iterate itself over tokens.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">12<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:param&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will add on a parameter to the url imported using &lt;import&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">13<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:redirect &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">This tag will redirect the user to new url<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">14<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;c:url&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">This tag will create a url with certain query parameters.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Formatting Tags in JSP<\/h3>\n<p>Formatting tags format the display of the date, time, text, especially for international websites. Through the following syntax, you can include the formatting library in JSP<br \/>\n<strong>Syntax:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ taglib prefix = \"fmt\" uri = \"http:\/\/java.sun.com\/jsp\/jstl\/fmt\" %&gt;\r\n<\/pre>\n<table>\n<tbody>\n<tr>\n<td><b>S.No.<\/b><\/td>\n<td><b>Tag<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:formatNumber&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will format a numerical value to a precision.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:parseNumber&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will parse the string representation of currency, percentage or number.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:formatDate&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will format the date with styles and patterns.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:parseDate&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will parse the string representation of date or time.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">5<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:bundle&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method will load a resource bundle that is to be used by its body section.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Loads a resource bundle to be used by its tag body.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:setLocale&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will store the locale information in the Locale variable.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">7<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:setBundle&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method will store the loaded resource bundle in a named variable or bundle configuration variable.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">8<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:timeZone&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will specify the time zone for a time formatting.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">9<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:setTimeZone&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method will store the time zone in a time zone configuration variable.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">10<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:message&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will display internationalized. message<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">11<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;fmt:requestEncoding&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This method will set a request for character encoding.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>JSTL SQL Tags<\/h3>\n<p>These JSTL tags will help in interacting with databases like MySQL, Oracle, etc. The syntax to include SQL library is as follows:<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ taglib prefix = \"sql\" uri = \"http:\/\/java.sun.com\/jsp\/jstl\/sql\" %&gt;\r\n<\/pre>\n<p>JSTL SQL tags are as follows:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>S.No.<\/b><\/td>\n<td><b>Tag<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;sql:setDataSource&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will create a database that is simply for prototyping.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;sql:query&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will execute the query on the database.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;sql:update&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will execute the update query defined in its body.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4<\/span><\/p>\n<p><span style=\"font-weight: 400\">5<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;sql:param&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">&lt;sql:dateParam&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will set a parameter to the query statement with a specific value.<\/span><\/p>\n<p><span style=\"font-weight: 400\">This tag will set a parameter for the sql statement and set it with java.util.Date value<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;sql:transaction &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag executes all the actions or statements as one transaction. This is done over a shared connection.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>JSTL XML Tags<\/h3>\n<p>These XML tags provide an easy way to manipulate XML documents. XML tag library has custom tags to interact with XML data. These interactions are transforming, controlling flow, parsing the XML data.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ taglib prefix = \"x\" uri = \"http:\/\/java.sun.com\/jsp\/jstl\/xml\" %&gt;\r\n<\/pre>\n<p>XML JSTL Tags are as follows:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>S.No.<\/b><\/td>\n<td><b>Tag<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:out&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is alike &lt;%=\u2026%&gt; but it is for XPath details.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<td>&lt;x:parse&gt;<\/td>\n<td><span style=\"font-weight: 400\">This tag will parse the XML data present in its section.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:set &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will set the variable to XPath information.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:if &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will evaluate the XPath expression. If this expression is true, it executes the body. It will be ignored if false.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">5<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:forEach&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag will loop for each statement in the body.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:choose&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is implacable when there are conditional operations that are mutually exclusive. This tag is used with &lt;when&gt; and &lt;otherwise&gt; tags.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">7<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:when &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is a subtag <\/span><b>&lt;choose&gt;<\/b><span style=\"font-weight: 400\">. If the expression is true, then it will include its body part.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">8<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:otherwise&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag runs when the condition is false. It is a subtag of <\/span><b>&lt;choose&gt;<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">9<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:transform&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag does transformation on an XML document.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">10<\/span><\/td>\n<td><span style=\"font-weight: 400\">&lt;x:param &gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This tag is used to set a parameter in the stylesheets. It is used with <\/span><b>transform<\/b><span style=\"font-weight: 400\"> tags.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>JSTL Functions<\/h3>\n<p>JSTL has a number of standard functions. They do string manipulation. Syntax to include Functions library of JSTL in JSP is as follows \u2212<br \/>\n<strong>Syntax<\/strong>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ taglib prefix = \"fn\" uri = \"http:\/\/java.sun.com\/jsp\/jstl\/functions\" %&gt;\r\n<\/pre>\n<p>Various JSTL Functions are as follows:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>S.No.<\/b><\/td>\n<td><b>Function<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:contains()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will test that a string contains a particular substring or not.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:containsIgnoreCase()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will test the same as above but in a case insensitive manner.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:endsWith()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will test that the string ends with the given suffix.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:escapeXml()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will escape the XML characters.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">5<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:indexOf()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function gives the starting index of the substring in a string.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:join()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will form a string from all the elements of a given array.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">7<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:length()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will return the number of characters in a string or the number of items in a list.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">8<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:replace()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will replace a string with the other given string. The result will return as a replaced one.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">9<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:split()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will split a string. It will form an array of these substrings.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">10<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:startsWith()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will check that a string starts with a specific prefix or not.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">11<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:substring()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function returns a substring.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">12<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:substringAfter()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will return a substring after a particular substring.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">13<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:substringBefore()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will return a substring before a particular substring.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">14<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:toLowerCase()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will convert the string to lowercase.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">15<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:toUpperCase()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will convert string to upper case.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">16<\/span><\/td>\n<td><span style=\"font-weight: 400\">fn:trim()<\/span><\/td>\n<td><span style=\"font-weight: 400\">This function will trim white space from both ends of the string.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Features of JSTL<\/h3>\n<p>The tags simplify the task to create Web pages, especially for designers. They provide the following features.<\/p>\n<ul>\n<li>JSTL core tags provide iterative tags. It supports the processing of the URL\u2019s resources in a JSP page to locate URLs.<\/li>\n<li>XML tag library helps in manipulating the XML documents.<\/li>\n<li>They provide conditional and iteration processing on XML documents.<\/li>\n<li>It supports internationalized web applications so that they are globally available for use. It makes the application localized so that it is reliable and effective. Internationalized libraries help it adapt to various locales.<\/li>\n<li>JSTL provides functions from the functions tag library to perform actions like checking for substring passed as the parameter in the function is present in a string, the number of characters in a string, etc.<\/li>\n<li>It provides the SQL tag library to retrieve and connect with the relational databases using these SQL tags.<\/li>\n<\/ul>\n<h3>Advantages of JSTL<\/h3>\n<ol>\n<li><strong>Standard Tag:<\/strong> The code is easy to understand for the developers as it provides the portable functionality for a JSP page.<\/li>\n<li><strong>Clean code:<\/strong> JSTL makes the code clean, as the scriptlet code can be confusing.<\/li>\n<li><strong>Easy for humans to read:<\/strong> As the code is in XML format, it is neat, clean, and easier to understand.<\/li>\n<li><strong>Better off for computers to understand:<\/strong> Parsing of the JSTL becomes easier for the HTML as the JSTL code is written in the XML format.<\/li>\n<li><strong>Javabeans Introspection Support:<\/strong> JSTL simplifies the use of bean objects, unlike JSP.<\/li>\n<\/ol>\n<h3>Example of JSTL<\/h3>\n<p>In this example, we have printed all the numbers from 1 to 5.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ taglib uri=\"http:\/\/java.sun.com\/jstl\/core\" prefix=\"c\" %&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt; Numbers&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n\r\n  &lt;body&gt;\r\n  &lt;c:forEach var=\"i\" begin=\"1\" end=\"5\"&gt;\r\n  \tValue&lt;c:out value=\"${i}\" \/&gt;\r\n\r\n  \t&lt;br \/&gt;\r\n  &lt;\/c:forEach&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Explanation:<\/strong> An iteration tag for each. It takes a beginning and an ending value and iterates over.<\/p>\n<p><strong>Output:<\/strong> The output will be as follows:<\/p>\n<p>Value1<br \/>\nValue2<br \/>\nValue3<br \/>\nValue4<br \/>\nValue5<\/p>\n<h2>Conclusion<\/h2>\n<p>This article consists of a detailed description of the standard tag library for JSP, known as JSTL. We also saw the tags in this library, as well as the functions present in it. Then we saw the way to install it. Finally, we also pondered upon some of its advantages and features.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to DataFlair JST Tutorial. This article discusses the JSTL, i.e., Standard Tag Library of JSP. It discusses the tags and functions present in it in detail. So let&#8217;s see JSP Standard tag Library&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":81438,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22403],"tags":[23096,23098,23097],"class_list":["post-81369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jsp","tag-jsp-standard-tag-library","tag-jsp-standard-tag-library-introduction","tag-jsp-standard-tag-library-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JSP Standard Tag Library Tutorial - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn about JSP Standard Tag Library - What is JSTL, its installation, Features, uses, advantages and limitations in JSP, JSTL tags and their classification\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSP Standard Tag Library Tutorial - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn about JSP Standard Tag Library - What is JSTL, its installation, Features, uses, advantages and limitations in JSP, JSTL tags and their classification\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-01T03:30:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T08:17:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JSP Standard Tag Library Tutorial - DataFlair","description":"Learn about JSP Standard Tag Library - What is JSTL, its installation, Features, uses, advantages and limitations in JSP, JSTL tags and their classification","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/","og_locale":"en_US","og_type":"article","og_title":"JSP Standard Tag Library Tutorial - DataFlair","og_description":"Learn about JSP Standard Tag Library - What is JSTL, its installation, Features, uses, advantages and limitations in JSP, JSTL tags and their classification","og_url":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-09-01T03:30:39+00:00","article_modified_time":"2021-08-25T08:17:21+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"JSP Standard Tag Library Tutorial","datePublished":"2020-09-01T03:30:39+00:00","dateModified":"2021-08-25T08:17:21+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/"},"wordCount":1689,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg","keywords":["JSP Standard Tag Library","JSP Standard Tag Library introduction","JSP Standard Tag Library tutorial"],"articleSection":["JSP Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/","url":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/","name":"JSP Standard Tag Library Tutorial - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg","datePublished":"2020-09-01T03:30:39+00:00","dateModified":"2021-08-25T08:17:21+00:00","description":"Learn about JSP Standard Tag Library - What is JSTL, its installation, Features, uses, advantages and limitations in JSP, JSTL tags and their classification","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSTL-introduction.jpg","width":1200,"height":628,"caption":"JSP Standard Tag Library"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/jsp-standard-tag-library-jstl\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"JSP Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/jsp\/"},{"@type":"ListItem","position":3,"name":"JSP Standard Tag Library Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/81369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=81369"}],"version-history":[{"count":2,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/81369\/revisions"}],"predecessor-version":[{"id":81439,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/81369\/revisions\/81439"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/81438"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=81369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=81369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=81369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}