JSP Command [3] --- taglib

Source: Internet
Author: User
Tags rfc

Taglib command

Define 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

The "% @ taglib %" 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 includes the start tag of JSP: plugin and the end tag of/jsp: plugin. jsp: Params and JSP: fallback can also be used.

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. For details, see http://www.hu.fi/u/jkorpela/rfc/2#/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, public in, is invalid if no public is written here. 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.