SlideShare a Scribd company logo
{
JSP custom tags
}
1. Introduction to JSP
2. Scripting elements
3. Running a Simple JSP program
4. Custom tags
1. Introduction
2. Advantages
3. Fields & Methods
4. A simple Custom tag
5. Attributes in Custom tags
6. Iteration in Custom tags
1. Just like Servlets its also used to create Web applications
2. It can be thought of as an extension to Servlets
3. A JSP page consists of HTML tags and JSP tags
4. It provides some additional features
1. Expression Language
2. Custom Tags, etc
A brief Intro to JSP
1. Extension to Servlet
2. Easy to maintain
3. Fast Development: No need to recompile and redeploy
4. Less code than Servlet
Advantages
Scripting elements
The scripting elements provides the ability to insert java code inside the jsp.
• scriptlet tag
A scriptlet tag is used to execute java source code in JSP.
• expression tag
written to the output stream of the response
• declaration tag
The JSP declaration tag is used to declare fields and methods.
A simple JSP page
Custom tags
Introduction
• Custom tags are user-defined tags.
• They separates the business logic from the JSP page.
• The same business logic can be used many times by the use of custom tag.
Syntax of custom tag
1. < prefix : tagname />
2. < prefix : tagname attr1 = value1 ...attrn = valuen />
3. < prefix : tagname attr1 = value1 ...attrn = valuen >
body code
</ prefix : tagname >
Fields & Methods
A simple custom tag
example
• Create the Tag handler class and perform action at the start or at the end of
the tag.
• Create the Tag Library Descriptor (TLD) file and define tags
• Create the JSP file that uses the Custom tag defined in the TLD file
 Define the property in the TagHandler class with the attribute
name and define the setter method.
 Define the attribute element inside the tag element in the TLD file
Attributes in custom tags
< m : cube number = “ 4 “ > < / m : cube >
 doAfterBody()
 EVAL_BODY_AGAIN
Iteration in Custom tags
Bye…

More Related Content

What's hot

Java script
Java scriptJava script
Java script
Jay Patel
 
Using SVG with Ample SDK cross browser
Using SVG with Ample SDK cross browserUsing SVG with Ample SDK cross browser
Using SVG with Ample SDK cross browser
Sergey Ilinsky
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & css
Predhin Sapru
 
Java script
Java scriptJava script
Java script
Fajar Baskoro
 
Java Script An Introduction By HWA
Java Script An Introduction By HWAJava Script An Introduction By HWA
Java Script An Introduction By HWA
Emma Wood
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
borkweb
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
borkweb
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to Sightly
Ankit Gubrani
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentation
bryanbibat
 
CSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JSCSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JS
Richard Homa
 
Introduction to HTML, CSS, and Javascript
Introduction to HTML, CSS, and JavascriptIntroduction to HTML, CSS, and Javascript
Introduction to HTML, CSS, and Javascript
Agustinus Theodorus
 
Introduction to HAML
Introduction to HAMLIntroduction to HAML
Introduction to HAMLJon Dean
 
Java script
Java scriptJava script
Java script
Soham Sengupta
 
Java Script
Java ScriptJava Script
Java Script
husbancom
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web Designing
Rasan Samarasinghe
 
OSS BarCamp Mumbai - JSON Presentation and Demo
OSS BarCamp Mumbai - JSON Presentation and DemoOSS BarCamp Mumbai - JSON Presentation and Demo
OSS BarCamp Mumbai - JSON Presentation and DemoKetan Khairnar
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Marlon Jamera
 
Javascript
JavascriptJavascript
Javascript
Iblesoft
 
Java script basics
Java script basicsJava script basics
Java script basics
Thakur Amit Tomer
 

What's hot (20)

Javascript
JavascriptJavascript
Javascript
 
Java script
Java scriptJava script
Java script
 
Using SVG with Ample SDK cross browser
Using SVG with Ample SDK cross browserUsing SVG with Ample SDK cross browser
Using SVG with Ample SDK cross browser
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & css
 
Java script
Java scriptJava script
Java script
 
Java Script An Introduction By HWA
Java Script An Introduction By HWAJava Script An Introduction By HWA
Java Script An Introduction By HWA
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to Sightly
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentation
 
CSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JSCSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JS
 
Introduction to HTML, CSS, and Javascript
Introduction to HTML, CSS, and JavascriptIntroduction to HTML, CSS, and Javascript
Introduction to HTML, CSS, and Javascript
 
Introduction to HAML
Introduction to HAMLIntroduction to HAML
Introduction to HAML
 
Java script
Java scriptJava script
Java script
 
Java Script
Java ScriptJava Script
Java Script
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web Designing
 
OSS BarCamp Mumbai - JSON Presentation and Demo
OSS BarCamp Mumbai - JSON Presentation and DemoOSS BarCamp Mumbai - JSON Presentation and Demo
OSS BarCamp Mumbai - JSON Presentation and Demo
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Javascript
JavascriptJavascript
Javascript
 
Java script basics
Java script basicsJava script basics
Java script basics
 

Similar to JSP custom tags

Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15
Smita B Kumar
 
Jsp , javasportal, jsp basic,
Jsp , javasportal, jsp basic, Jsp , javasportal, jsp basic,
Jsp , javasportal, jsp basic, rupendra1817
 
JSP
JSPJSP
Java annotations
Java annotationsJava annotations
Java annotations
FAROOK Samath
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
Shah Nawaz Bhurt
 
Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech
Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa AptechSession 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech
Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa AptechMasterCode.vn
 
presentation on online movie ticket booking
presentation on online movie ticket bookingpresentation on online movie ticket booking
presentation on online movie ticket booking
dharmawath
 
JSTL.pptx
JSTL.pptxJSTL.pptx
JSTL.pptx
SPAMVEDANT
 
JSP : Creating Custom Tag
JSP : Creating Custom Tag JSP : Creating Custom Tag
JSP : Creating Custom Tag
AshishSingh Bhatia
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
Nuha Noor
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
Raheela Patel
 
SCWCD : Java server pages CHAP : 9
SCWCD : Java server pages  CHAP : 9SCWCD : Java server pages  CHAP : 9
SCWCD : Java server pages CHAP : 9
Ben Abdallah Helmi
 
GTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVAGTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVA
TOPS Technologies
 
Jsplecture
JsplectureJsplecture
Jsplecture
mustafacse2009
 
Jsp lecture
Jsp lectureJsp lecture
005432796.pdf
005432796.pdf005432796.pdf
005432796.pdf
EidTahir
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Ayes Chinmay
 
Jsp
JspJsp
Implementing jsp tag extensions
Implementing jsp tag extensionsImplementing jsp tag extensions
Implementing jsp tag extensions
Soujanya V
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
APSMIND TECHNOLOGY PVT LTD.
 

Similar to JSP custom tags (20)

Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15
 
Jsp , javasportal, jsp basic,
Jsp , javasportal, jsp basic, Jsp , javasportal, jsp basic,
Jsp , javasportal, jsp basic,
 
JSP
JSPJSP
JSP
 
Java annotations
Java annotationsJava annotations
Java annotations
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech
Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa AptechSession 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech
Session 9 : intro to custom tags-classic tag - Giáo trình Bách Khoa Aptech
 
presentation on online movie ticket booking
presentation on online movie ticket bookingpresentation on online movie ticket booking
presentation on online movie ticket booking
 
JSTL.pptx
JSTL.pptxJSTL.pptx
JSTL.pptx
 
JSP : Creating Custom Tag
JSP : Creating Custom Tag JSP : Creating Custom Tag
JSP : Creating Custom Tag
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
SCWCD : Java server pages CHAP : 9
SCWCD : Java server pages  CHAP : 9SCWCD : Java server pages  CHAP : 9
SCWCD : Java server pages CHAP : 9
 
GTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVAGTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVA
 
Jsplecture
JsplectureJsplecture
Jsplecture
 
Jsp lecture
Jsp lectureJsp lecture
Jsp lecture
 
005432796.pdf
005432796.pdf005432796.pdf
005432796.pdf
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
 
Jsp
JspJsp
Jsp
 
Implementing jsp tag extensions
Implementing jsp tag extensionsImplementing jsp tag extensions
Implementing jsp tag extensions
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 

JSP custom tags

  • 2. 1. Introduction to JSP 2. Scripting elements 3. Running a Simple JSP program 4. Custom tags 1. Introduction 2. Advantages 3. Fields & Methods 4. A simple Custom tag 5. Attributes in Custom tags 6. Iteration in Custom tags
  • 3. 1. Just like Servlets its also used to create Web applications 2. It can be thought of as an extension to Servlets 3. A JSP page consists of HTML tags and JSP tags 4. It provides some additional features 1. Expression Language 2. Custom Tags, etc A brief Intro to JSP
  • 4. 1. Extension to Servlet 2. Easy to maintain 3. Fast Development: No need to recompile and redeploy 4. Less code than Servlet Advantages
  • 5. Scripting elements The scripting elements provides the ability to insert java code inside the jsp. • scriptlet tag A scriptlet tag is used to execute java source code in JSP. • expression tag written to the output stream of the response
  • 6. • declaration tag The JSP declaration tag is used to declare fields and methods.
  • 8. Custom tags Introduction • Custom tags are user-defined tags. • They separates the business logic from the JSP page. • The same business logic can be used many times by the use of custom tag.
  • 9. Syntax of custom tag 1. < prefix : tagname /> 2. < prefix : tagname attr1 = value1 ...attrn = valuen /> 3. < prefix : tagname attr1 = value1 ...attrn = valuen > body code </ prefix : tagname >
  • 11.
  • 12. A simple custom tag example • Create the Tag handler class and perform action at the start or at the end of the tag. • Create the Tag Library Descriptor (TLD) file and define tags • Create the JSP file that uses the Custom tag defined in the TLD file
  • 13.  Define the property in the TagHandler class with the attribute name and define the setter method.  Define the attribute element inside the tag element in the TLD file Attributes in custom tags < m : cube number = “ 4 “ > < / m : cube >