SlideShare a Scribd company logo
1 of 19
Slide 1 of 29
Introduction to Custom Tags
Classic tag
Slide 2 of 29
Overview
 Custom Tags
 Various type of Custom Tags
 Components of Tag Library
 javax.servlet.jsp.tagext package
 Common methods of Custom Tags
Slide 3 of 29
Custom Tags
 Allow Java programmer to embed Java
codes in JSP documents
 Provide a mechanism to reuse and
encapsulate complex recurring code or
tasks in JSP
 Provide simplicity and reusability of Java
code
 Structure of custom tags in JSP is similar to
XML tags
Slide 4 of 29
Various Types of Custom Tag
 Empty tags
<td:welcome />
 Tags with attributes
<td: welcome color=”blue”></td:welcome>
 Tags with a body
<td: welcome>
<%=today_date%>
</td:welcome>
 Nested tags
<td1:ifTag condition “<%=eval>“ >
<td2:valueTrue>The expression evaluates to true
Slide 5 of 29
Component of Tag Library
 Tag Handler
 Tag Library Descriptor [TLD]
 Tag File
Slide 6 of 29
Mechanisms for building custom tags
 Tag Handler
 Tag files
Slide 7 of 29
Mechanisms for building custom tags
 Tag Handler
– Classic Tag
– Simple Tag
Slide 8 of 29
Classic Tag
Slide 9 of 29
javax.servlet.jsp.tagext package
– Classic Custom Tag
Classic tags is a JSP 1.2 technology. The
classic tag handler class can be created by
extending implementing .
• Tag
• IterationTag
• BodyTag
• TagSupport
• BodyTagSupport
Slide 10 of 29
tagext package
 Tag - Interface
– Is the base tag handler interface that defines
the methods required by all tag handlers
• public int doStartTag() throws JspException
• public int doEndTag() throws JspException
• public void release()
 IterationTag - Interface
– Used when a custom tag needs to repeatedly
re-evaluate its body
– Useful for looping through a collection of
Objects without using a scriptlet
• public int doAfterBody() throws JspException
Slide 11 of 29
tagext package
 BodyTag - Interface
– Provide features for manipulating the body content
• public void doInitBody() throws JspException
• public void setBodyContent(BodyContent b)
 BodyContent - Class
– Is a subclass of the JSPWriter class
– represents the body content of a tag
 TagSupport - Class
– Implements the Tag and IterationTag Interfaces.
– Supports tag and a tag with body iterations
Slide 12 of 29
tagext package
 BodyTagSupport - Class
– Sub class of TagSupport & implements BodyTag
– used to develop custom tags with body
Slide 13 of 29
Tag Library Descriptor [TLD]
 Is an xml file that contains the tag library
description
 Contains the list and description of all custom
tags in the library
 Provides the JSP engine with meta-information
about the custom tag and about its
implementation
 Components of the TLD classified into two
groups
<taglib> </taglib>
<tag> </tag>
Slide 14 of 29
Structure of TLD file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>first</shortname>
<info>Example of a tag</info>
<tag>
<name>welcome</name>
<tagclass>TestTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>An example</info>
</tag>
</taglib>
Slide 15 of 29
Execution of JSP with Custom Tags
Execution Cycle of a JSP file with Custom Tags
Slide 16 of 29
Deploying and Using Custom Tags
 Create a Tag Library Descriptor (.tld) file in the tlds folder
inside WEB-INF
 Create a Tag Handler class in proper package with tld file.
 Include taglib directive in target JSP page
 Use the custom tag
Slide 17 of 29
tagext package
 Returns value of doStartTag()
– SKIP_BODY
– EVAL_BODY_INCLUDE
– EVAL_BODY_BUFFERED
 Return value of doEndTag()
– SKIP_PAGE
– EVAL_PAGE
 Return value of doAfterBody()
– SKIP_BODY
– EVAL_BODY_AGAIN
Slide 18 of 29
Tag Life Cycle
Instantiate Tag
Handler
doStartTag()
doEndTag()
return
value
setBodyContent()
doInitBody()
doAfterBody()
return
value
Evaluate
Body
return
value
Evaluate rest
of the Page
Return from
current page
EVAL_BODY_BUFFERED
EVAL_BODY_INCLUD
E
SKIP_BODY
SKIP_BODY
EVAL_BODY_AGAIN
SKIP_PAGE
EVAL_PAGE
Slide 19 of 29
Summary
 Custom Tags
 Various type of Custom Tags
 Components of Tag Library
 javax.servlet.jsp.tagext package
 Common methods of Custom Tags
 Tag life cycle
 Tag Library Descriptor
 Execution of JSP with Custom Tags
 Deploying and Using Custom Tags

More Related Content

Viewers also liked

Rename domain controller server 2012
Rename domain controller server 2012Rename domain controller server 2012
Rename domain controller server 2012laonap166
 
Mcsa 2012 local user and group
Mcsa 2012 local user and groupMcsa 2012 local user and group
Mcsa 2012 local user and grouplaonap166
 
Cài đặt exchange server 2013
Cài đặt exchange server 2013Cài đặt exchange server 2013
Cài đặt exchange server 2013laonap166
 
Mcsa 2012 file server và share permission
Mcsa 2012 file server và share permissionMcsa 2012 file server và share permission
Mcsa 2012 file server và share permissionlaonap166
 
BÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệu
BÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệuBÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệu
BÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệuMasterCode.vn
 
Windows routing phần 2
Windows routing phần 2Windows routing phần 2
Windows routing phần 2laonap166
 
CVNguyenThanhLam-102015-Vi
CVNguyenThanhLam-102015-ViCVNguyenThanhLam-102015-Vi
CVNguyenThanhLam-102015-ViLam Nguyen
 
ScrumDay Vietnam 2012 - Scrum with Team Foundation Server - Quang
ScrumDay Vietnam 2012 - Scrum with Team Foundation Server - QuangScrumDay Vietnam 2012 - Scrum with Team Foundation Server - Quang
ScrumDay Vietnam 2012 - Scrum with Team Foundation Server - QuangDUONG Trong Tan
 
Mcsa 2012 monitor server performance
Mcsa 2012 monitor server performanceMcsa 2012 monitor server performance
Mcsa 2012 monitor server performancelaonap166
 
Bài 6 CỤM HỆ THỐNG
Bài 6 CỤM HỆ THỐNGBài 6 CỤM HỆ THỐNG
Bài 6 CỤM HỆ THỐNGMasterCode.vn
 
Mcsa 2012 domain network
Mcsa 2012 domain networkMcsa 2012 domain network
Mcsa 2012 domain networklaonap166
 
Cấu hình dhcp failover trên windows server 2012
Cấu hình dhcp failover trên windows server 2012Cấu hình dhcp failover trên windows server 2012
Cấu hình dhcp failover trên windows server 2012laonap166
 
Triển khai nhiều domain controller chạy song song trên windows server 2012
Triển khai nhiều domain controller chạy song song trên windows server 2012Triển khai nhiều domain controller chạy song song trên windows server 2012
Triển khai nhiều domain controller chạy song song trên windows server 2012laonap166
 
Cài đặt và cấu hình dhcp server trên windows server 2012
Cài đặt và cấu hình dhcp server trên windows server 2012Cài đặt và cấu hình dhcp server trên windows server 2012
Cài đặt và cấu hình dhcp server trên windows server 2012laonap166
 
Bài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPT
Bài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPTBài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPT
Bài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPTMasterCode.vn
 
BÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPT
BÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPTBÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPT
BÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPTMasterCode.vn
 

Viewers also liked (16)

Rename domain controller server 2012
Rename domain controller server 2012Rename domain controller server 2012
Rename domain controller server 2012
 
Mcsa 2012 local user and group
Mcsa 2012 local user and groupMcsa 2012 local user and group
Mcsa 2012 local user and group
 
Cài đặt exchange server 2013
Cài đặt exchange server 2013Cài đặt exchange server 2013
Cài đặt exchange server 2013
 
Mcsa 2012 file server và share permission
Mcsa 2012 file server và share permissionMcsa 2012 file server và share permission
Mcsa 2012 file server và share permission
 
BÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệu
BÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệuBÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệu
BÀI 10 : Nâng cao hiệu quả hoạt động cơ sở dữ liệu
 
Windows routing phần 2
Windows routing phần 2Windows routing phần 2
Windows routing phần 2
 
CVNguyenThanhLam-102015-Vi
CVNguyenThanhLam-102015-ViCVNguyenThanhLam-102015-Vi
CVNguyenThanhLam-102015-Vi
 
ScrumDay Vietnam 2012 - Scrum with Team Foundation Server - Quang
ScrumDay Vietnam 2012 - Scrum with Team Foundation Server - QuangScrumDay Vietnam 2012 - Scrum with Team Foundation Server - Quang
ScrumDay Vietnam 2012 - Scrum with Team Foundation Server - Quang
 
Mcsa 2012 monitor server performance
Mcsa 2012 monitor server performanceMcsa 2012 monitor server performance
Mcsa 2012 monitor server performance
 
Bài 6 CỤM HỆ THỐNG
Bài 6 CỤM HỆ THỐNGBài 6 CỤM HỆ THỐNG
Bài 6 CỤM HỆ THỐNG
 
Mcsa 2012 domain network
Mcsa 2012 domain networkMcsa 2012 domain network
Mcsa 2012 domain network
 
Cấu hình dhcp failover trên windows server 2012
Cấu hình dhcp failover trên windows server 2012Cấu hình dhcp failover trên windows server 2012
Cấu hình dhcp failover trên windows server 2012
 
Triển khai nhiều domain controller chạy song song trên windows server 2012
Triển khai nhiều domain controller chạy song song trên windows server 2012Triển khai nhiều domain controller chạy song song trên windows server 2012
Triển khai nhiều domain controller chạy song song trên windows server 2012
 
Cài đặt và cấu hình dhcp server trên windows server 2012
Cài đặt và cấu hình dhcp server trên windows server 2012Cài đặt và cấu hình dhcp server trên windows server 2012
Cài đặt và cấu hình dhcp server trên windows server 2012
 
Bài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPT
Bài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPTBài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPT
Bài 3: Làm việc với kiểu dữ liệu và mã kịch bản - Giáo trình FPT
 
BÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPT
BÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPTBÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPT
BÀI 4: Lệnh lựa chọn và quy trình phát triển phần mềm - Giáo trình FPT
 

Similar to Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech

Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15Smita B Kumar
 
Implementing jsp tag extensions
Implementing jsp tag extensionsImplementing jsp tag extensions
Implementing jsp tag extensionsSoujanya V
 
Implementing java server pages standard tag library v2
Implementing java server pages standard tag library v2Implementing java server pages standard tag library v2
Implementing java server pages standard tag library v2Soujanya V
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...WebStackAcademy
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java CodingRahul Bhutkar
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )Adarsh Patel
 
Jsp standard tag_library
Jsp standard tag_libraryJsp standard tag_library
Jsp standard tag_libraryKP Singh
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules RestructuredDoiT International
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 

Similar to Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech (20)

Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15
 
Implementing jsp tag extensions
Implementing jsp tag extensionsImplementing jsp tag extensions
Implementing jsp tag extensions
 
JSP custom tags
JSP custom tagsJSP custom tags
JSP custom tags
 
JSP : Creating Custom Tag
JSP : Creating Custom Tag JSP : Creating Custom Tag
JSP : Creating Custom Tag
 
Jsp tag library
Jsp tag libraryJsp tag library
Jsp tag library
 
Session_15_JSTL.pdf
Session_15_JSTL.pdfSession_15_JSTL.pdf
Session_15_JSTL.pdf
 
Jsp session 9
Jsp   session 9Jsp   session 9
Jsp session 9
 
Jstl 8
Jstl 8Jstl 8
Jstl 8
 
Implementing java server pages standard tag library v2
Implementing java server pages standard tag library v2Implementing java server pages standard tag library v2
Implementing java server pages standard tag library v2
 
Jsplecture
JsplectureJsplecture
Jsplecture
 
Jsp lecture
Jsp lectureJsp lecture
Jsp lecture
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 8 ...
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java Coding
 
JSTL.pptx
JSTL.pptxJSTL.pptx
JSTL.pptx
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )
 
Xml session
Xml sessionXml session
Xml session
 
Jsp standard tag_library
Jsp standard tag_libraryJsp standard tag_library
Jsp standard tag_library
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules Restructured
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 

More from MasterCode.vn

Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnPd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnMasterCode.vn
 
Why apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnWhy apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnMasterCode.vn
 
Dzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnDzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnMasterCode.vn
 
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnGoogle công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnMasterCode.vn
 
Nghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnNghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnMasterCode.vn
 
Lập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnLập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnMasterCode.vn
 
Pd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnPd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnMasterCode.vn
 
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnPd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnMasterCode.vn
 
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnPdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnMasterCode.vn
 
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnPd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnMasterCode.vn
 
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnPd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnMasterCode.vn
 
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnPd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnMasterCode.vn
 
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnPdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnMasterCode.vn
 
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vnPdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vnPdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vnPdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vnPdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vnPdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vnPdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vnPdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 

More from MasterCode.vn (20)

Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnPd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
 
Why apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnWhy apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vn
 
Dzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnDzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vn
 
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnGoogle công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
 
Nghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnNghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vn
 
Lập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnLập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vn
 
Pd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnPd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vn
 
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnPd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
 
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnPdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
 
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnPd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
 
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnPd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
 
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnPd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
 
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnPdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
 
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vnPdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vnPdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vnPdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vnPdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vnPdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vnPdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vnPdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech

  • 1. Slide 1 of 29 Introduction to Custom Tags Classic tag
  • 2. Slide 2 of 29 Overview  Custom Tags  Various type of Custom Tags  Components of Tag Library  javax.servlet.jsp.tagext package  Common methods of Custom Tags
  • 3. Slide 3 of 29 Custom Tags  Allow Java programmer to embed Java codes in JSP documents  Provide a mechanism to reuse and encapsulate complex recurring code or tasks in JSP  Provide simplicity and reusability of Java code  Structure of custom tags in JSP is similar to XML tags
  • 4. Slide 4 of 29 Various Types of Custom Tag  Empty tags <td:welcome />  Tags with attributes <td: welcome color=”blue”></td:welcome>  Tags with a body <td: welcome> <%=today_date%> </td:welcome>  Nested tags <td1:ifTag condition “<%=eval>“ > <td2:valueTrue>The expression evaluates to true
  • 5. Slide 5 of 29 Component of Tag Library  Tag Handler  Tag Library Descriptor [TLD]  Tag File
  • 6. Slide 6 of 29 Mechanisms for building custom tags  Tag Handler  Tag files
  • 7. Slide 7 of 29 Mechanisms for building custom tags  Tag Handler – Classic Tag – Simple Tag
  • 8. Slide 8 of 29 Classic Tag
  • 9. Slide 9 of 29 javax.servlet.jsp.tagext package – Classic Custom Tag Classic tags is a JSP 1.2 technology. The classic tag handler class can be created by extending implementing . • Tag • IterationTag • BodyTag • TagSupport • BodyTagSupport
  • 10. Slide 10 of 29 tagext package  Tag - Interface – Is the base tag handler interface that defines the methods required by all tag handlers • public int doStartTag() throws JspException • public int doEndTag() throws JspException • public void release()  IterationTag - Interface – Used when a custom tag needs to repeatedly re-evaluate its body – Useful for looping through a collection of Objects without using a scriptlet • public int doAfterBody() throws JspException
  • 11. Slide 11 of 29 tagext package  BodyTag - Interface – Provide features for manipulating the body content • public void doInitBody() throws JspException • public void setBodyContent(BodyContent b)  BodyContent - Class – Is a subclass of the JSPWriter class – represents the body content of a tag  TagSupport - Class – Implements the Tag and IterationTag Interfaces. – Supports tag and a tag with body iterations
  • 12. Slide 12 of 29 tagext package  BodyTagSupport - Class – Sub class of TagSupport & implements BodyTag – used to develop custom tags with body
  • 13. Slide 13 of 29 Tag Library Descriptor [TLD]  Is an xml file that contains the tag library description  Contains the list and description of all custom tags in the library  Provides the JSP engine with meta-information about the custom tag and about its implementation  Components of the TLD classified into two groups <taglib> </taglib> <tag> </tag>
  • 14. Slide 14 of 29 Structure of TLD file <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> <taglib> <tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion> <shortname>first</shortname> <info>Example of a tag</info> <tag> <name>welcome</name> <tagclass>TestTag</tagclass> <bodycontent>JSP</bodycontent> <info>An example</info> </tag> </taglib>
  • 15. Slide 15 of 29 Execution of JSP with Custom Tags Execution Cycle of a JSP file with Custom Tags
  • 16. Slide 16 of 29 Deploying and Using Custom Tags  Create a Tag Library Descriptor (.tld) file in the tlds folder inside WEB-INF  Create a Tag Handler class in proper package with tld file.  Include taglib directive in target JSP page  Use the custom tag
  • 17. Slide 17 of 29 tagext package  Returns value of doStartTag() – SKIP_BODY – EVAL_BODY_INCLUDE – EVAL_BODY_BUFFERED  Return value of doEndTag() – SKIP_PAGE – EVAL_PAGE  Return value of doAfterBody() – SKIP_BODY – EVAL_BODY_AGAIN
  • 18. Slide 18 of 29 Tag Life Cycle Instantiate Tag Handler doStartTag() doEndTag() return value setBodyContent() doInitBody() doAfterBody() return value Evaluate Body return value Evaluate rest of the Page Return from current page EVAL_BODY_BUFFERED EVAL_BODY_INCLUD E SKIP_BODY SKIP_BODY EVAL_BODY_AGAIN SKIP_PAGE EVAL_PAGE
  • 19. Slide 19 of 29 Summary  Custom Tags  Various type of Custom Tags  Components of Tag Library  javax.servlet.jsp.tagext package  Common methods of Custom Tags  Tag life cycle  Tag Library Descriptor  Execution of JSP with Custom Tags  Deploying and Using Custom Tags