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