JSP syntax (7)

Source: Internet
Author: User

Taglib command
Defines a tag Library and the prefix of its custom tags.

JSP syntax

<% @ Taglib uri = "URIToTagLibrary" prefix = "tagPrefix" %>

Example

<% @ Taglib uri = "http://www.jspcentral.com/tags" prefix = "public" %>
<Public: loop>
.
.
</Public: loop>

Description

<% @ Taglib %> the command declares that the JSP file uses custom tags, reference the tag library, and specify the prefix of their tags.

Here, custom tags include tags and elements. Because JSP files can be converted to XML, it is important to understand the relationship between tags and elements. A tag is only a tag that is elevated in the sense and is part of a JSP element. JSP elements are part of the JSP syntax, and have the start tag and end tag like XML. An element can also contain other text, tags, and elements. For example, a jsp: plugin element has the <jsp: plugin> start tag and </jsp: plugin> end tag, and can also have <jsp: params> and <jsp: fallback> element.

You must use the <% @ taglib %> command before using a custom tag, and you can use it multiple times on a page, but the prefix can only be used once.

Attribute

Uri = "URIToTagLibrary"
The Uniform Resource Identifier (URI) uniquely names a custom tag Based on the tag prefix. The URI can be the following:

Uniform Resource Locator (URL), defined by RFC 2396, view the http://www.hut.fi/u/jkorpela/rfc/2396/full.html
 
Uniform Resource Name (URN), defined by RFC 2396
 
A relative or absolute path
Prefix = "tagPrefix"
The prefix before the custom tag. For example, in <public: loop>, if public is not specified here, this is invalid. Do not use jsp, jspx, java, javax, servlet, sun, or sunw as your prefix.

Related Article

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.