Jstl TLD Configuration __js

Source: Internet
Author: User
Tags tld

I. JSTL library

Standard.jar

Jstl.jar

two. TLD Configuration

1. Non-automatic loading mode

(1) Copy TLD file

Copy the TLD file to the Web-inf TLD folder

(2) Web.xml

<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fn</taglib-uri>
<taglib-location>/WEB-INF/tld/fn.tld</taglib-location>
</taglib>
</jsp-config>

(3) referencing taglib in JSP

<%@ taglib prefix= "C" uri= "Http://java.sun.com/jstl/core"%>

2. Automatic loading mode

The Servlet2.4 specification provides automatic loading of TLD files, which are in the Standard.jar Meta-inf folder.

such as: C.tld file provides a description of the core JSTL tag

<taglib xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version= "2.0" >

<DESCRIPTION>JSTL 1.1 Core Library</description>
<display-name>jstl core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>

You can see that its reference URI is Http://java.sun.com/jsp/jstl/core

Then reference taglib in the JSP as: <%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%>

 

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.