Académique Documents
Professionnel Documents
Culture Documents
(chapter 8+9)
1/14
Objectives
Tag Libraries The Custom Tag Development Process Hunting the Tag Custom Tag Example JSTL (read at home)- JSP Standard Tag Library Tag Interfaces and Classes in javax.servlet.jsp.tagext The Classic Custom Tag Event Model Tags and Implicit Variables
2/14
4/14
Custom Tags
Separates the work profiles of Web designers and developers Custom tags can be reused Written using XML syntax The different types of custom tags are:
Empty tag Tag with attributes Body tags
JAD Session 14 - Custom Tags 5/14
Custom Tags
The function of the tag can be customized using the attributes in the custom tags TLD file contains the details of the tag attributes Custom tag body can include static text, HTML, and JSP elements like scriptlets, between the start and the end tag.
6/14
JSP Document
<html> <body> <%@taglib uri="test_taglib" prefix="myTag"%> <myTag:showDate/> </body> </html>
Demo\CusTags
9/14
10/14
JSP container processing one occurrence of a tag implementing the Tag Interface in one JSP page.
JAD Session 14 - Custom Tags 11/14
12/14
13/14
14/14
<short-name>bd</short-name> <tag> <name>welcome</name> <tag-class>taglib.customWelcome</tag-class> <body-content>empty</body-content> <attribute> <name>ten</name> </attribute> <attribute> <name>kieuNgay</name> </attribute> </tag>
JAD Session 14 - Custom Tags
15/14
16/14
18/14
Summary
Tag Libraries The Custom Tag Development Process Hunting the Tag Custom Tag Example JSTL (read at home) Tag Interfaces and Classes in javax.servlet.jsp.tagext The Classic Custom Tag Event Model Tags and Implicit Variables
Q&A
JAD Session 14 - Custom Tags 19/14