Summary of tag files and TLD files in JSP

Source: Internet
Author: User
Tags tld

The tag and TLD files can be referenced in JSP files.
1. For tag files
<% @ Taglib prefix = "UI" tagdir = "/WEB-INF/tags" %>
The tags directory contains several tag files.
But when using <Ti: XXXX>, directory WEB-INF/tags, there must be a XXXX. Tag file and the corresponding.

2. For TLD files
You can reference TLD files in JSP, such
<% @ Taglib uri = "http://struts.apache.org/tags-html" prefix = "html" %>
But what should I do if I check whether the http: // struts.apache.org/tags-html matches?
JSP will find all TLD files under the \ WEB-INF of the current directory and confirm which TLD file the URL corresponds.
When the struts-html.tld file is located, it is found that it corresponds to this URL.
However, when <HTML: yyyyy> is used, there must be a corresponding yyyy item in the TLD file.

There is also a more secure way to add in the WEB-INF/Web. xml
<Taglib>
<Taglib-Uri>
Http://jakarta.apache.org/tomcat/examples-taglib
</Taglib-Uri>
<Taglib-location>
/WEB-INF/JSP/example-taglib.tld
</Taglib-location>
</Taglib>
This indicates success

The tag file is generally used for a small part.Code, Similar to the function of the include file.
TLD files have complex functions and can achieve many advanced functions.

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.