Jstl and its core (CORE) label Library

Source: Internet
Author: User
Tags tld

Custom JSP labels are an effective way to replace Java program fragments in JSP. Most Web application JSP files often implement some common functions. To improve the development efficiency of Web applications, Sun has developed a set of standard tag library specifications, which are calledJstl(JSP standard tag library ).

The jstl tag library actually contains five different tag libraries.Jstl1.1 SpecificationConventions are made for the Uris and prefixes of these tag libraries.

Type of jstl tag Library
Tag library name Prefix Uri Description
Core C Http://java.sun.com/jsp/jstl/core Core tag library, including general-purpose tags, condition tags, iteration tags, and URL-related tags
I18n FMT Http://java.sun.com/jsp/jstl/fmt Includes tags for writing international web applications and tags for formatting date, time, and number
SQL SQL
Http://java.sun.com/jsp/jstl/ SQL Includes tags for accessing the relational database
XML X Http://java.sun.com/jsp/jstl/xml Tags that contain operations on XML documents
Functions FN Http://java.sun.com/jsp/jstl/functions Contains a set of general El functions that can be used in El expressions.

Using jstl requires two jar packages:

Jstl. Jar: Class file that contains interfaces and classes defined in the jstl specification.

Standard. Jar: Contains the class file that Apache open source software organization is used to implement jstl, and under its META-INF directory, contains the TLD file of the five tag libraries listed in the table above. The TLD file of each tag library describes all tags in the library, including the Tag Name and implementation class of the tag.

Jstl core tag Library:

The core tag library is the most commonly used tag library when writing JSP files. It includes the followingTag:

Tag Description
<C: Out> Used to print the result of an expression to a webpage.
<C: Set> Used to set the value of a named variable. If the name variable is JavaBean, you can also set the value of the JavaBean attribute. If the name variable is map type, you can also set the value corresponding to the key in it.
<C: Remove> Used to delete a named variable
<C: Catch> Used to capture exceptions and place the exception object in the specified name variable
<C: If> Used to implement the if statement function in Java
<C: Choose> <C: When> <C: otherwise> Used to implement the IF-else statement function in Java
<C: foreach> Used to traverse objects in the set and to repeatedly execute the label subject
<C: fortokens> It is used to traverse the sub-strings separated by specific delimiters in a string, and the tag subject can be repeatedly executed.
<C: Import> Used to include other web resources, similar to the <JSP: Include> command
<C: URL> Used to reconstruct a URL based on a specific rewrite rule
<C: Redirect> Used for redirection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.