JSTL | JSP Standard Tag Library - GeeksforGeeks

14 Aug, 2021
Introduction:
Initially, Web designers used scriptlets in JSP pages to generate dynamic content. This resulted in readability issues and also made it difficult to maintain the JSP page. Custom tags were introduced to overcome the problems faced in using scriptlets. Although custom tags proved to be a better choice than scriptlets they had certain limitations too Web designers had to spend a lot of time in coding packaging and testing these tags before using them. This meant that Web designers were often left with little time to concentrate on the designing of Web pages. 
The introduction of JSTL has helped Web designers overcome the shortcomings of custom tags, by encapsulating the common functionalities that the Web designer may need to develop Web pages. These functionalities included the use of tag libraries such as core, SQL and XML. JSTL is Introduced particularly for those Web designers who are not well versed with Java programming JSTL 1.2, introduced in the Java EE 5 platform, aligns with the unified EL. Note that the unified EL helps JavaServer Faces(JSF) to use JSTL tags. The same version of JSTL, i.e. JSTL 1.2, is used in the Java EE 6 platform as well.
Features of JSTL: 
JSTL aims to provide an easy way to maintain SP pages The use of tags defined in JSTL has Simplified the task of the designers to create Web pages. They can now simply use a tag related to the task that they need to implement in a JSP page. The main features of JSTL are as follows:
Provides support for conditional processing and Uniform Resource Locator (URL)-related actions to process URL resources in a JSP page. You can also use the JSTL core tag library that provides iterator tags used to easily iterate through a collection of objects.
Provides the XML tag library, which helps you to manipulate XML documents and perform actions related to conditional and iteration processing on parsed XML documents.
Enables Web applications to be accessed globally by providing the internationalization tag library Internationalization means that an application can be created to adapt to various locales so that people of different regions can access the application in their native languages The internationalization tag library makes the implementation of localization in an application easy, fast and effective.
Enables interaction with relational databases by using various SQL commands Web applications require databases to store information required for the application, which can be manipulated by using the SQL tag library provided by JSTL.
Provides a series of functions to perform manipulations, such as checking whether an input String contains the substring specified as a parameter to a function or returning the number of items in a collection, or the number of characters in a 5tring These functions can be used in an El expression and are provided by the functions tag library.
Tag Libraries in JSTL: 
A tag library provides a number of predefined actions that behind functionalities to a specific JSP page. JSTL provides tag libraries that include a wide range of actions to perform common tasks. For example, if you want to access data from database, you can use SQL tag library in your applications. JSTL is a standard tag library that is composed of five tag libraries. Each of these tag libraries represents separate functional area and is used with a prefix. Below table describes the tag libraries available in JSTL. 
Example of JSTL:
The <c:set> Tag with bodyvariable can be set by using the <c:set> tag within the body of another tag as in the following code snnipate: 
<c:set var="bookname"> 
My book: java 8 
</c:set> 
<c:out value="${bookname}"/>  
In the preceding code snippet, the value for the bookname variable is set in the body of the <c:set> tag. Here <c:out> tag is used for printing the output.
How to download and install JSTL: 
Download JSTL.jar and Standard.jar file from here (or you will get these from your native Apache tomcat installation too!).Now put both the files into your ‘WEB-INF/lib’ folder.After this, add them to classpath also.Finally, you can use JSTL into your project.
Download JSTL.jar and Standard.jar file from here (or you will get these from your native Apache tomcat installation too!).
Now put both the files into your ‘WEB-INF/lib’ folder.
After this, add them to classpath also.
Finally, you can use JSTL into your project.
sooda367
Java-JSP
Articles
GBlog
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to write a Pseudo Code?
SQL Interview Questions
Understanding "extern" keyword in C
Mutex vs Semaphore
Analysis of Algorithms | Set 3 (Asymptotic Notations)
Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, ...
DSA Sheet by Love Babbar
Socket Programming in C/C++
GET and POST requests using Python
Must Do Coding Questions for Product Based Companies