1. JSTL Overview
JSTL (JSP standard tag Library), JSP standards tag libraries, can be embedded in the JSP page using the form of tags to complete business logic and other functions.
The purpose of the JSTL is to replace the script code in the JSP page, as is the case with El.
The JSTL standard Tag Library has 5 sub-libraries, but as it develops, its core library is often used today
Tag Library |
The URI of the tag library |
Prefix |
Core |
Http://java.sun.com/jsp/jstl/core |
C |
i18n |
Http://java.sun.com/jsp/jstl/fmt |
Fmt |
Sql |
Http://java.sun.com/jsp/jstl/sql |
Sql |
Xml |
Http://java.sun.com/jsp/jstl/xml |
X |
Functions |
Http://java.sun.com/jsp/jstl/functions |
Fn |
2. Jstl Download and Import
Jstl Download:
Download the Jstl jar package from the Apache website. Go to the "http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/" url to download the JSTL installation package, Jakarta-taglibs-standard-1.1.2.zip.
Then unzip the downloaded JSTL installation package, and at this point, you can see two jar files in the Lib directory, respectively, Jstl.jar and Standard.jar.
Where the Jstl.jar file contains the interfaces and related classes defined in the JSTL specification, the Standard.jar file contains the. class file used to implement JSTL and 5 tag Library descriptor files (TLDs) in Jstl
Import two jar packages into the lib of our project
Import the core tag library using JSP taglib directives
3. Common tags for jstl core libraries
1) <c:if test= "" > Label
Where test is the condition that returns a Boolean
2) <c:forEach> label
There are two combinations of modes of use:
El and Jstl Learning (ii)--JSTL technology