-
Tag language features
<attribute start tag = "attribute value"> tag body </ tag end>Empty tag
<Start label> </ end label>
<label start /> -
Since the development and use steps to define the label
2.1 to create a label helper class (inherited BodyTagSupport)
tag attributes must attribute the corresponding helper class, and to provide the corresponding get / set methods
rtexprvalue
2.2 Creating a tag library descriptor (tld), add a custom tag configuration
Note: tld files must be saved to the WEB-INF directory or its subdirectories
jstl tag library
my label provides a description file, you can copy the past to create the file extension instead .tld
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<!-- 标签库描述符 -->
<taglib xmlns="http://java.sun.com/JSP/TagLibraryDescriptor">
<!-- 代表标签库的版本号 -->
<tlib-version>1.0</tlib-version>
<!-- 代表jsp的版本 -->
<jsp-version>1.2</jsp-version>
<!-- 你的标签库的简称 -->
<short-name>test</short-name>
<!-- 你标签库的引用uri -->
<uri>/zking</uri>
<tag>
<!-- 标签名 -->
<name>yy</name>
<!-- 标签工具类 -->
<tag-class>com.zking.TestTag</tag-class>
<!-- 标签的内容类型:empty表示空标签,jsp表示可以为任何合法的JSP元素 -->
<body-content>jsp</body-content>
<!-- 自定义标签的属性定义,请注意一定要在标签类中提供对应的get/set方法 -->
<attribute>
<!-- 自定义标签的属性名称 -->
<name>name</name>
<!-- true表示必填 -->
<required>true</required>
<!-- true支持动态值,可以向值里面填jsp表达式、EL表达式,false则不支持 -->
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
2.3 taglib introduced by instruction tag library JSP, and accessed by the suffix to specify custom label
3. Label Lifecycle
SKIP_BODY: not Skip body is calculated content
EVAL_BODY_INCLUDE: calculated tag's body and [Output]
EVAL_PAGE: calculating subsequent portion of the page
SKIP_PAGE: skipping subsequent portions are not connected the tab page
EVAL_BODY_AGAIN: a body recalculation