Jakarta Standard Tag Library
{{Short description|Component of the Jakarta EE Web application development platform}}
{{Infobox programming language
| name = JSTL
| latest release version = 3.0.0
| latest release date = {{Start date and age|2022|05|14}}
| website = {{Official URL}}
| operating system = Multiplatform
| file_ext = .jsp .jspf .jsf
}}
The Jakarta Standard Tag Library (JSTL; formerly JavaServer Pages Standard Tag Library) is a component of the Java EE Web application development platform. It extends the JSP specification by adding a tag library of JSP tags for common tasks, such as XML data processing, conditional execution, database access, loops and internationalization.
Specification
JSTL was developed under the Java Community Process (JCP) as Java Specification Request (JSR) 52. On May 8, 2006, JSTL 1.2 was released, followed by JSTL 1.2.1 on Dec 7, 2011.{{Cite web|url=http://search.maven.org/#browse%7C707331597|title = Maven Central Repository Search}}
In addition to JSTL, the JCP has the following JSRs to develop standard JSP tag libraries:
- [http://www.jcp.org/en/jsr/detail?id=128 JSR 128]: JESI – JSP Tag Library for Edge Side Includes (inactive)
- [http://www.jcp.org/en/jsr/detail?id=267 JSR 267]: JSP Tag Library for Web Services
General Responsibilities
JSTL provides an effective way to embed logic within a JSP page without using embedded Java code directly. The use of a standardized tag set, rather than breaking in and out of Java code, leads to more maintainable code and enables separation of concerns between the development of the application code and user interface.
= Tag Library Descriptor =
There are a total of six JSTL Tag Library Descriptors:
- Core library. E.g. {{angbr|c:if}}{{sfn | Murach | Urban | 2014 | loc=§2 Essential servlet and JSP skills - How to use the if tag | pp=282-283}} and {{angbr|c:when}}{{Cite web|url=http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/tld-summary.html|title=JSTL core (TLDDoc Generated Documentation)}}{{sfn | Murach | Urban | 2014 | loc=§2 Essential servlet and JSP skills - How to use the choose tag | pp=284-285}}
- i18n-capable formatting library{{Cite web|url=http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/tld-summary.html|title = JSTL FMT (TLDDoc Generated Documentation)}}
- Database tag library, contains tags for querying, creating and updating database table.{{Cite web|url=http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/sql/tld-summary.html|title = JSTL SQL (TLDDoc Generated Documentation)}}
- XML library{{Cite web|url=http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/x/tld-summary.html|title=JSTL XML (TLDDoc Generated Documentation)}}
- functions library{{Cite web|url=http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fn/tld-summary.html|title = JSTL functions (TLDDoc Generated Documentation)}}
- TLVs allow translation-time validation of the XML view of a JSP page. The TLVs provided by JSTL allow tag library authors to enforce restrictions regarding the use of scripting elements and permitted tag libraries in JSP pages.{{Cite web|url=http://docs.oracle.com/javaee/6/api/javax/servlet/jsp/jstl/tlv/package-summary.html|title = Javax.servlet.JSP.JSTL.TLV (Java EE 6 )}}
A Tag Library Descriptor is also known as TLD. A TLD is an XML document, so it is case-sensitive.{{sfn | Murach | Urban | 2014 | loc=§2 Essential servlet and JSP skills - The tag element | pp=310-311}}
== Core Library ==
The JSTL core library is the most commonly used library{{sfn | Murach | Urban | 2014 | loc=§2 Essential servlet and JSP skills - How to enable the core JSTL library | pp=178}} and holds the core tags for common tasks.{{sfn | Murach | Urban | 2014 | loc=§9 How to use JSTL | pp=270-273}} Examples of common tasks include if/else statements and loops.{{sfn | Murach | Urban | 2014 | loc=§9 How to use JSTL | pp=270-273}} It is mandatory to use a taglib
directive to specify the URI of the JSTL core library using a prefix.{{sfn | Murach | Urban | 2014 | loc=§2 Essential servlet and JSP skills - How to enable the core JSTL library | pp=178}} Although there are many options for the prefix, the c
prefix is most commonly chosen prefix for this library. {{sfn | Murach | Urban | 2014 | loc=§2 Essential servlet and JSP skills - How to enable the core JSTL library | pp=178}}
See also
Citations
{{Reflist}}
References
- {{cite book | last=Murach | first=Joel | last2=Urban | first2=Michael | title=Murach's Java Servlets and JSP | date=2014 | isbn=978-1-890774-78-3}}
External links
- {{Official website}}
- [https://jakarta.ee/specifications/tags/ JakartaEE JSTL specification]
- [http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/ JSTL TLDDocs]
- [http://www.jcp.org/en/jsr/detail?id=52 JSR 52] (JSTL 1.0, 1.1, and 1.2)
- [https://web.archive.org/web/20050911044327/http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html Jakarta Standard Taglib 1.1], an implementation of JSTL (retired)
- [http://tomcat.apache.org/taglibs/standard/ Apache Standard Taglib] an implementation of the JSP Standard Tag Library (JSTL) specification
- [http://www.oio.de/public/java/jstl-reference/index.htm JSTL 1.0 Referenz (German)] {{Webarchive|url=https://web.archive.org/web/20190306174749/http://www.oio.de/public/java/jstl-reference/index.htm |date=2019-03-06 }}
- [http://jstl.java.net JSTL 1.2 home page] {{Webarchive|url=https://web.archive.org/web/20161116210559/http://jstl.java.net/ |date=2016-11-16 }}
- [http://java.sun.com/javaee/5/docs/tutorial/doc/bnakc.html Official Tutorial: The Java EE 5 Tutorial, Chapter 7, JavaServer Pages Standard Tag Library]{{Cite web|url=http://jstl.java.net/getStarted.html|title=JSTL-api|access-date=2011-07-26|archive-date=2011-08-18|archive-url=https://web.archive.org/web/20110818232704/http://jstl.java.net/getStarted.html|url-status=dead}}
- [http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/ JSTL 1.1 References]
- [http://docs.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/ JSF 2.1 Facelets Tag Library Documentation][http://docs.oracle.com/javaee/ Java EE Technical Documentation]
- [https://web.archive.org/web/20131216020401/http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/org/owasp/esapi/tags/package-summary.html OWASP ESAPI Tags] (as JSTL does not offer any tags for website security)
{{Jakarta EE}}