Taglib Applications in JSP (3)--zt

Source: Internet
Author: User
Tags contains insert resource rfc tld
Taglib applications in JS JSP (3)


Customize the tag location

Web-inf/tlds/xxxx.tld


Note: You need to define in the TLD file:

Tlibversion--------The version of the Tag library

Jspversion--------The JSP version required by this tag library.

ShortName-------the default name. (Not defined in this example)

Uri-------------------The URL of this tag library

Info-----------------usage information for Tag Library

Tag-----------------a custom tag

Name---------------the names of the custom tag

Tagclass-----------The name of the Java class that handles this tag. Different tags may correspond to different Java classes.

Teiclass----------


Bodycontent-----Mark the type of the property value, if not identified, implied as a JSP

JSP-------------------interpreted by page

EMPTY-----------------No Body allowed

Tagdependent-----Interpreted by tag

Need Bodytag

Bodytag can post-process JSP


Info------------------The use information of this tag

Attribute-----------attributes. Each tag can have n attributes



In this example, four tags are defined.

Customize the tag location

Explain the attribute in detail.

Indicates the name of the property that the tag contains

True indicates that this property is required

Or

False indicates that this property is not required

Implied as false

True indicates that the value of this property can be output with the results of a JSP program segment.

Or

False indicates that the value of this property cannot be output with the results of a JSP program segment.

Implied as false

-----------------------------------------------------------------------------------

Take insert tag as an example, the tag named insert is defined, and his processing file is Com.sun.estore.taglib.InsertTag

The type of the property value is the JSP, followed by the definition of three properties. Reference in the JSP page.

Now you should be able to understand the approximate meaning of this TLD file. We write our own TLD file in this format.

There should be no more problems. If you still don't understand, it's good to see the books on XML.


Using a TLD file in a JSP file is a command

The use of comrade flying knife in the JSP syntax inside the explanation.

Customize the tag location

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Taglib directives

Defines a tag library and its prefix for a custom label.


JSP syntax



Example



.

.


Describe

directive declares that this JSP file uses a custom label, referencing the tag library,

Also specifies the prefix of their labels.

The custom label here contains the label and the element. Because JSP files can be translated into XML,

So it's important to understand the links between tags and elements. The label is just a sense of being carried

A higher mark, part of a JSP element. JSP elements are part of the JSP syntax, and XML

There are starting and closing tags as well. Elements can also contain other text, tags, and elements.

For example, a jsp:plugin element has a start tag and an end tag, and the same

can also have and elements.

You must use instructions before using a custom label, and you can use it more than once in a page, but the prefix can only be used once

Customize the tag location

Uri= "Uritotaglibrary"

The Uniform Resource Identifier (URI) uniquely names a custom label based on the prefix of the label, which can be the following:

? Uniform Resource Locator (URL), defined by RFC 2396,

View 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"

Prefix before the custom label, for example, public in, if no public is written here,

Then this is illegal. Please do not use JSP, Jspx, Java, javax, servlet, Sun, and sunw as your prefix


=======================template.jsp====================


To use this example, please go to aspcn.com


===============================================


A JSP file is defined here. This file is made up of the tag defined in the previous example.

JSP engine through the processing of tag, JSP program section of the operation results and some HTML tag combination,

Returns a full HTML result to the browser end.

What's interesting here is that depending on the parameters, the file can return different content. This is commonly referred to as the template file.

Unfortunately this article does not talk about these, just introduction in the JSP file using tag. Interested can study for themselves

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.