jsp taglib指令
The taglib directive is used to define tag library that the current JSP page uses. A JSP page might include several tag library. JavaServer Pages Standard Tag Library (JSTL), is a collection of useful JSP tags, which provides mahy commonly used core functionalities. It has support for many general, structural tasks such as iteration and conditionals, readymade tags for manipulating XML documents, internationalization tags, and for performing SQL operations. Syntax of taglib directive is:
taglib指令用于定义当前JSP页面使用的标记库。 一个JSP页面可能包含几个标记库。 JavaServer Pages标准标记库(JSTL)是有用的JSP标记的集合,该标记提供了许多常用的核心功能。 它支持许多常规的结构性任务,例如迭代和条件,用于处理XML文档的现成标签,国际化标签以及执行SQL操作。 taglib指令的语法为:
<%@ taglib prefix="prefixOfTag" uri="uriOfTagLibrary" %>
The prefix is used to distinguish the custom tag from other libary custom tag. Prefix is prepended to the custom tag name. Every custom tag must have a prefix.
该前缀用于将自定义标签与其他库自定义标签区分开。 前缀是自定义标签名称的前缀。 每个自定义标签都必须有一个前缀。
The URI is the unique name for Tag Library.
URI是标签库的唯一名称。
You can name the prefix anything, but it should be unique.
您可以为前缀命名,但应唯一。
JSP:使用Taglib指令 (JSP: Using Taglib Directive)
To use the JSTL in your application you must have the jstl.jar
in your webapps /WEB-INF/lib
directory. Download the jar file from Apache Standard Taglib page.
要在应用程序中使用JSTL,必须在webapps /WEB-INF/lib
目录中具有jstl.jar
。 从Apache Standard Taglib页面下载jar文件。
There are many readymade JST Libraries available which you use to make your life easier. Following is a broad division on different groups of JST libraries :
有许多现成的JST库可供您使用,它们使您的生活更轻松。 以下是对不同组的JST库的大致划分:
Core Tags - URI → http://java.sun.com/jsp/jstl/core
核心标签-URI→http://java.sun.com/jsp/jstl/core
Formatting Tags - URI → http://java.sun.com/jsp/jstl/fmt
格式标签-URI→http://java.sun.com/jsp/jstl/fmt
SQL Tags - URI → http://java.sun.com/jsp/jstl/sql
SQL标记-URI→http://java.sun.com/jsp/jstl/sql
XML Tags - URI → http://java.sun.com/jsp/jstl/xml
XML标记-URI→http://java.sun.com/jsp/jstl/xml
JSTL Functions - URI → http://java.sun.com/jsp/jstl/functions
JSTL函数-URI→http://java.sun.com/jsp/jstl/functions
You can check the complete JST Library here : Apache Standard Taglib API
您可以在此处检查完整的JST库: Apache Standard Taglib API
翻译自: https://www.studytonight.com/jsp/jsp-taglib-directive.php
jsp taglib指令