Case study of JSP custom tag
This paper introduces the case of JSP custom tag for your reference. The specific contents are as follows
Case 1: implement a basic anti-theft chain label
1. Label processing
2. Description document
3. Introduction and use
JSP2. 0 custom label
---|Simpletag interface
Defines the lifecycle method of the label processing class. doTag()
-----|Simpletagsupport class
All the methods of simpletag interface are implemented, so we only need to inherit and override this class later.
Case 2: implement your own if Else tag
Objectives:
analysis:
1. ChooseTag. Java, you must define a tag field attribute
2. WhenTag. java
3. Otherwise. java
4. Description document
5. Introduction and use
Package custom label Library
1. Create a taglibs folder
2. Copy the class files corresponding to all label processing classes together with the package to the directory in 1
3. Create a meta inf folder in the folder in 1
4. Copy the TLD file to the meta inf directory
5. Edit TLD file and introduce URI element: < URI > http://www.jnb.com < / URI > long provides the URL path of the import
6. Use the jar command to package: D: \ mytaglibs > jar CVF JNB jar *
summary
Mainly master how to use JSP 2 0 to develop and package custom labels.
1. Create a taglibs folder
2. Copy the class files corresponding to all label processing classes together with the package to the directory in 1
3. Create a meta inf folder in the folder in 1
4. Copy the TLD file to the meta inf directory
5. Edit TLD file and introduce URI element: < URI > http://www.jnb.com < / URI > long provides the URL path of the import
6. Use the jar command to package: D: \ mytaglibs > jar CVF JNB jar *
summary
Mainly master how to use JSP 2 0 to develop and package custom labels.