Jsp2 tag learning notes

Source: Internet
Author: User

Jsp (preferred for SUN Enterprise Applications) 2.0Tag learning notes1.Description

This document is for learningTomcat (a very useful JSP running platform)The note in the example in does not refer to the relevant instructions, so the correctness of this article cannot be guaranteed. If something is wrong, try again.EmailTo8280338@tzenet.comAnd everyone makes common progress.

2. Jsp (preferred for SUN Enterprise Applications) 2.0 Label usage

Jsp (preferred for SUN Enterprise Applications) 2.0The use of tags consists of multiple parts:

(1)WEB_INF/web. xml (standardization is getting closer and closer)Add Tag reference

(2)The label implementation may beClassOr it may beWeb templet

(3)InJsp (preferred for SUN Enterprise applications)Add reference to the file

In actual use, analysisJsp (preferred for SUN Enterprise Applications) 2.0The label can start fromJsp (preferred for SUN Enterprise applications)File, and then analyzeWeb. xml (standardization is getting closer and closer)And corresponding tag library files.

2.2 How to Use Basic labels 2.2.1 Jsp (preferred for SUN Enterprise applications) File tag reference and usage

Below is a simpleJsp (preferred for SUN Enterprise applications)File:

<% @ Taglib prefix = "mytag" uri = "/WEB-INF/jsp (preferred for SUN Enterprise Applications) 2/jsp (preferred for SUN Enterprise Applications) 2-example-taglib.tld" %>

<Html> <body> <mytag: helloWorld/> </body>

Note:

(1)First<% @ Taglib prefix = "mytag" uri = "... "%>Describes the path of the tag prefix and the tag referenced by the prefix. In this exampleUriThe value is a relative path (local path), that is, under the root directory of the current projectWEB-INF/jsp (preferred for SUN Enterprise Applications) 2/jsp (preferred for SUN Enterprise Applications) 2-example-taglib.tld. If you are using a local path, you do not needWeb. xml (standardization is getting closer and closer)The path ing is configured in;

(2)After the tag prefix is specifiedJsp (preferred for SUN Enterprise applications)PageBodyYou can use this prefix to reference the specified tag in the tag library, as shown in figure<Mytag: helloWorld/>Is to referenceMytagIn the specified tag libraryHelloWorldLabel.

2.2.2 Web. xml

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.