What are JSTL tags? What are the commonly used tag libraries?

  Starting from the JSP1.1 specification, JSP supports the use of custom tags. Using custom tags greatly reduces the complexity of JSP pages and at the same time enhances code reuse. For this reason, many web application manufacturers have customized their own application tag libraries. However, the tags of the same function may be different if they are made by different web application vendors. This has led to the emergence of many tags with the same function on the market, making web page creators There is no choice. In order to solve this problem, Sun has developed a set of standard tag library (JavaServer Pages Standard Tag Library), referred to as JSTL.

  Although JSTL is called the standard tag library, in fact this tag library is composed of 5 tag libraries with different functions. In the JSTL1.1 specification, different URIs and recommended prefixes are specified for these five tag libraries, as shown in Table 1.

Figure

  Table 1 Tag libraries included in JSTL

  Table 1 lists all the tag libraries included in JSTL, as well as the URIs and recommended prefixes of each tag library in JSTL. These tag libraries will be explained separately in the following.

  ● Core is a core tag library, which contains tags that implement common operations in web applications. For example, a label used to output text content, a label used for conditional judgment, and a label used for iterative loops.

  ● I18N is an internationalization/formatting tag library, which contains internationalization tags and formatting tags that implement Web applications. For example, set the local information of the JSP page, set the time zone of the JSP page, and display the date in the local format.

  ● SQL is a database tag library, which contains tags for accessing the database and operating on the data in the database. For example, obtaining database connections from the database, retrieving data from database tables, etc. Because in the software layered development model, JSP pages only serve as the presentation layer, and generally do not directly manipulate the database in JSP pages, therefore, this set of tag libraries provided in JSTL is not often used.

  ● XML is a tag library for manipulating XML documents. It contains tags for manipulating data in XML documents. For example, parsing XML files, outputting content in XML documents, and iteratively processing elements in XML documents. XML is widely used in Web development, and it is easier and more convenient to use XML tag library to process XML documents.

  ● Function is a function tag library, which provides a set of custom EL functions, including string operations frequently used by JSP web page creators. For example, extract the substring in the string, get the length of the string, and so on.

I hope this article can be helpful to you who want to learn Java knowledge with zero foundation.

This article is from Qianfeng Education , please indicate the source for reprinting.


Guess you like

Origin blog.51cto.com/15128702/2678150