SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
Copyright © 2002 ProsoftTraining. All rights reserved.
JavaServer Pages
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 1:
Introduction to
JavaServer Pages
Objectives
• Define JavaServer Pages (JSP)
• Define Java servlets
• Define Enterprise JavaBeans (EJB)
• Compare JSP to other server-side
programming environments
• Explain the advantages of JSP
• Understand the mechanics of JSP documents
• Use basic JSP syntax
• Describe how to invoke JSP documents
What Is
Enterprise JavaBeans (EJB)?
• EJB = An architecture for deploying
component-based distributed applications
– J2EE-compliant application servers
What Are
Java Servlets?
• Java servlets provide the functionality of the
CGI for Java-driven Web applications
– Managed and executed on a Web server
that provides a servlet container
– Executed within a single JVM and server
process
What Is JSP?
• Server-side programming environment
– Contains normal HTML with special syntax
that allows dynamic content
Web Application Technologies
• Common Gateway Interface (CGI)
• Server extensions
• Server-side scripting
– ColdFusion
– PHP Hypertext Preprocessor (PHP)
JSP
Advantages and Mechanics
• Java = powerful programming language
– Built-in APIs
• JSP applications are portable
• JSP engine  locates the JSP document
• JSP engine  processes the JSP document
into a servlet
• JSP engine  passes control to servlet engine
Basic
JSP Syntax
• Script blocks
<% //Java code %>
• JSP files with comments
<%-- JSP comment --%>
Summary
 Define JavaServer Pages (JSP)
 Define Java servlets
 Define Enterprise JavaBeans (EJB)
 Compare JSP to other server-side
programming environments
 Explain the advantages of JSP
 Understand the mechanics of JSP documents
 Use basic JSP syntax
 Describe how to invoke JSP documents
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 2:
JSP Fundamentals
Objectives
• Describe various styles of JSP syntax
• Use JSP expressions
• Use JSP scriptlets
• Use JSP declarations
• Use predefined variables
Evaluating
Java Expressions
• Syntax:
<%= new java.util.Date( ) %>
Using JSP Scriptlets
• Scriptlets allow you to:
– Perform complex operations within a JSP
document
– Intersperse blocks of Java code with
normal HTML
Using JSP Declarations
• JSP declarations:
– Provide a construct in which to declare
methods and variables
– Do not produce output
– Use the following syntax:
<%! //Java code %>
Using JSP
Predefined Variables
• The request variable
• The response variable
• The out variable
• The application variable
• The session variable
• The config variable
• The pageContext variable
• The page variable
Summary
 Describe various styles of JSP syntax
 Use JSP expressions
 Use JSP scriptlets
 Use JSP declarations
 Use predefined variables
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 3:
JSP Directives
Objectives
• Define JSP directives
• Use the page directive
• Use page directive attributes
• Use the include directive
• Use the jsp:include element
• Add and manipulate Java applets in JSP files
using the jsp:plugin element
Introduction
to JSP Directives
• The page directive
– The import attribute
– The language attribute
– The contentType attribute
– The pageEncoding attribute
– The extends attribute
– The isThreadSafe attribute
– The session attribute
– The buffer attribute
– The autoFlush attribute
– The errorPage attribute
– The isErrorPage attribute
– The info attribute
Including
Files in JSP
• Using the include directive
• Using the jsp:include element
Using the
jsp:plugin Element
• The jsp:plugin element is used to:
– Add Java applets to JSP files
– Determine the appropriate tag for the client
browser accessing the JSP file
Summary
 Define JSP directives
 Use the page directive
 Use page directive attributes
 Use the include directive
 Use the jsp:include element
 Add and manipulate Java applets in JSP files
using the jsp:plugin element
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 4:
JSP and JavaBeans
Objectives
• Define JavaBeans
• Explain the concept of component-centric
architecture
• Describe the advantages of JavaBeans
• Instantiate JavaBeans
• Use JSP-JavaBeans tags to access and
manipulate JavaBeans properties
• Explain the conventions for constructing
JavaBeans
• Use the serializable interface
• Access JavaBeans through scripting elements
Component-Centric
Architecture
• Component-centric architecture:
– Allows for handling complexity
– Divides complex systems into components
JavaBeans
Java
server
Database
server
JSP—JavaBeans Tags
Tag Description
<jsp:useBean> Used to instantiate a JavaBean
and create a reference to it
<jsp:getProperty> Used to access a JavaBean
property
<jsp:setProperty> Used to modify a JavaBean
property
Rules for
Constructing JavaBeans
• Class
• Constructor
• Property
• Methods
– Regular methods
– Access methods
The JavaBean
Serializable Interface
• When a JavaBean is serialized, its property
values are frozen
• To make the JavaBean serializable, it should
implement the Serializable interface
Accessing JavaBeans Through
Scriptlets and Expressions
• After the <jsp:useBean> tag instantiates a
JavaBean and has a reference to it, the
JavaBean can be used in scriptlets and
expressions throughout the scope of the
JavaBean
Summary
 Define JavaBeans
 Explain the concept of component-centric
architecture
 Describe the advantages of JavaBeans
 Instantiate JavaBeans
 Use JSP-JavaBeans tags to access and
manipulate JavaBeans properties
 Explain the conventions for constructing
JavaBeans
 Use the serializable interface
 Access JavaBeans through scripting elements
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 5:
JSP Custom Tags
and Tag Libraries
Objectives
• Describe JSP custom tags
• Explain the need for JSP tag libraries
• Define and use the taglib directive
• Download, install and use a tag library
• Create custom handler classes and descriptor
files
• Create tag attributes
• Use a custom tag
• Deploy tag libraries
Why Use
Tag Libraries?
• Custom tag libraries:
– Allow you to create complex objects that
can be used by JSP developers
– Allow you to reuse code across multiple
JSP applications
Using
Custom Tags
• Using a tag library
– The number of pre-existing tag libraries is
growing
Creating JSP
Custom Tag Libraries
• Three steps to creating a custom tag:
– Define a tag handler class
– Define a tag library descriptor
– Define a JSP page that uses the custom tag
• The taglib directive
Using Custom
Tags in JSP Files
• Key elements of a custom tag:
– Tag name
– Attributes
– Nesting
– Body content
Tag Handlers
Tag
Library Descriptor
• Root element = <taglib>
• Subelements = tlibversion
shortname
info
• Deploying tag libraries
Summary
 Describe JSP custom tags
 Explain the need for JSP tag libraries
 Define and use the taglib directive
 Download, install and use a tag library
 Create custom handler classes and descriptor
files
 Create tag attributes
 Use a custom tag
 Deploy tag libraries
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 6:
JSP and Java Servlets
Objectives
• Define servlets
• Write simple servlets
• Discuss the difference between servlets and
JSPs
• Explain the concept of MVC design pattern
• Describe the layers of MVC design pattern
• Explain Models 1 and 2 Web application designs
• Define the RequestDispatcher interface
• Use the RequestDispatcher to dispatch
requests
Servlets
• Java servlets = Java classes that implement
the javax.servlet.Servlet interface
• Servlets have no main method for handling
requests
– Using the GET method
Servlets vs. JSP
• Manageability problems with servlets
• How can JSP help?
Web
Application Architecture
• Presentation layer
• Application layer
• Control layer
MVC
Design Pattern
JSP vs. Servlet Architecture
• Model 1 architecture
• Model 2 architecture
• Model 1 and Model 2 architecture trade-offs
Model 1
Architecture
Model 2
Architecture
Page-Centric Design
Servlet-Centric Design
Controlling the Flow
with RequestDispatcher
• Acquiring a RequestDispatcher object
• Using the RequestDispatcher object
• Where to place the servlets
• Incorporating another resource's output in a
servlet
• Forwarding a request from a JSP to other
resources
Summary
 Define servlets
 Write simple servlets
 Discuss the difference between servlets and
JSPs
 Explain the concept of MVC design pattern
 Describe the layers of MVC design pattern
 Explain Models 1 and 2 Web application
designs
 Define the RequestDispatcher interface
 Use the RequestDispatcher to dispatch
requests
Copyright © 2002 ProsoftTraining. All rights reserved.
Lesson 7:
JSP,
HTML Forms and Databases
Objectives
• Describe the tiers in a three-tier distributed
application
• Discuss a Web communication between tiers
• Use HTML forms and their input elements
• Use the request object to communicate
between HTML forms and JSP files
• Explain the concept of relational databases
• Use the main SQL statements
• Describe Java Database Connectivity
• Connect to a database and access information
• Create an example of an HTML form
Distributed
Multi-Tiered Applications
• Client tier
• Server tier
• Database tier
Steps in a
Typical Web Communication
http://java.sun.com/getjava/download.html
Hypertext
Transfer
Protocol
Host name
Path name
HTML Forms
• Text field input
• Radio button input
• Check box input
• Drop-down menu input
• Reset and
submit buttons
Request Object
• Contains:
– Methods for storing and retrieving attribute
values
– Methods for accessing request parameters
– Methods for retrieving request headers
– Methods for other uses
Relational
Databases
• Database Management System (DBMS)
• Queries
Structured
Query Language (SQL)
• Data Definition Language (DDL)
• Data Manipulation Language (DML)
• Data Control Language (DCL)
Java Database
Connectivity (JDBC)
• Load a JDBC driver
• Connect to a database
• Execute SQL statements
• Disconnect from a database
Summary
 Describe the tiers in a three-tier distributed
application
 Discuss a Web communication between tiers
 Use HTML forms and their input elements
 Use the request object to communicate
between HTML forms and JSP files
 Explain the concept of relational databases
 Use the main SQL statements
 Describe Java Database Connectivity
 Connect to a database and access information
 Create an example of an HTML form
JavaServer Pages
 Introduction to JavaServer Pages
 JSP Fundamentals
 JSP Directives
 JSP and JavaBeans
 JSP Custom Tags and Tag Libraries
 JSP and Java Servlets
 JSP, HTML Forms and Databases

Contenu connexe

Similaire à 005432796.pdf

SCWCD : Java server pages CHAP : 9
SCWCD : Java server pages  CHAP : 9SCWCD : Java server pages  CHAP : 9
SCWCD : Java server pages CHAP : 9Ben Abdallah Helmi
 
JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...MathivananP4
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabadrevanthonline
 
presentation on online movie ticket booking
presentation on online movie ticket bookingpresentation on online movie ticket booking
presentation on online movie ticket bookingdharmawath
 
Advance java session 9
Advance java session 9Advance java session 9
Advance java session 9Smita B Kumar
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
 
JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015Naz Ish
 
Project First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be usedProject First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be usedarya krazydude
 
Java Web services
Java Web servicesJava Web services
Java Web servicesSujit Kumar
 
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
 

Similaire à 005432796.pdf (20)

SCWCD : Java server pages CHAP : 9
SCWCD : Java server pages  CHAP : 9SCWCD : Java server pages  CHAP : 9
SCWCD : Java server pages CHAP : 9
 
JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...JavaScript, often abbreviated as JS, is a programming language and core techn...
JavaScript, often abbreviated as JS, is a programming language and core techn...
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabad
 
presentation on online movie ticket booking
presentation on online movie ticket bookingpresentation on online movie ticket booking
presentation on online movie ticket booking
 
Jsp basic
Jsp basicJsp basic
Jsp basic
 
Jsp
JspJsp
Jsp
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Advance java session 9
Advance java session 9Advance java session 9
Advance java session 9
 
Jsp
JspJsp
Jsp
 
Java
JavaJava
Java
 
Wt unit 4
Wt unit 4Wt unit 4
Wt unit 4
 
005428052.pdf
005428052.pdf005428052.pdf
005428052.pdf
 
JSP.pdf
JSP.pdfJSP.pdf
JSP.pdf
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design Patterns
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015
 
20jsp
20jsp20jsp
20jsp
 
Project First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be usedProject First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be used
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
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
 

Plus de EidTahir

Servlets+JSP.ppt
Servlets+JSP.pptServlets+JSP.ppt
Servlets+JSP.pptEidTahir
 
servlets.ppt
servlets.pptservlets.ppt
servlets.pptEidTahir
 
005428058.pdf
005428058.pdf005428058.pdf
005428058.pdfEidTahir
 
005428055.pdf
005428055.pdf005428055.pdf
005428055.pdfEidTahir
 
2.J2EE_Overview.ppt
2.J2EE_Overview.ppt2.J2EE_Overview.ppt
2.J2EE_Overview.pptEidTahir
 
009458666.pdf
009458666.pdf009458666.pdf
009458666.pdfEidTahir
 
009921362.pdf
009921362.pdf009921362.pdf
009921362.pdfEidTahir
 
009577496.pdf
009577496.pdf009577496.pdf
009577496.pdfEidTahir
 
009478419.pdf
009478419.pdf009478419.pdf
009478419.pdfEidTahir
 
009445185.pdf
009445185.pdf009445185.pdf
009445185.pdfEidTahir
 
009705432.pdf
009705432.pdf009705432.pdf
009705432.pdfEidTahir
 
009694598.pdf
009694598.pdf009694598.pdf
009694598.pdfEidTahir
 
enterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdfenterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdfEidTahir
 
010118565.pdf
010118565.pdf010118565.pdf
010118565.pdfEidTahir
 
005528214.pdf
005528214.pdf005528214.pdf
005528214.pdfEidTahir
 
009586150.pdf
009586150.pdf009586150.pdf
009586150.pdfEidTahir
 
009551323.pdf
009551323.pdf009551323.pdf
009551323.pdfEidTahir
 
009723779.pdf
009723779.pdf009723779.pdf
009723779.pdfEidTahir
 
005443266.pdf
005443266.pdf005443266.pdf
005443266.pdfEidTahir
 

Plus de EidTahir (20)

Servlets+JSP.ppt
Servlets+JSP.pptServlets+JSP.ppt
Servlets+JSP.ppt
 
servlets.ppt
servlets.pptservlets.ppt
servlets.ppt
 
005428058.pdf
005428058.pdf005428058.pdf
005428058.pdf
 
005428055.pdf
005428055.pdf005428055.pdf
005428055.pdf
 
DNS.pptx
DNS.pptxDNS.pptx
DNS.pptx
 
2.J2EE_Overview.ppt
2.J2EE_Overview.ppt2.J2EE_Overview.ppt
2.J2EE_Overview.ppt
 
009458666.pdf
009458666.pdf009458666.pdf
009458666.pdf
 
009921362.pdf
009921362.pdf009921362.pdf
009921362.pdf
 
009577496.pdf
009577496.pdf009577496.pdf
009577496.pdf
 
009478419.pdf
009478419.pdf009478419.pdf
009478419.pdf
 
009445185.pdf
009445185.pdf009445185.pdf
009445185.pdf
 
009705432.pdf
009705432.pdf009705432.pdf
009705432.pdf
 
009694598.pdf
009694598.pdf009694598.pdf
009694598.pdf
 
enterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdfenterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdf
 
010118565.pdf
010118565.pdf010118565.pdf
010118565.pdf
 
005528214.pdf
005528214.pdf005528214.pdf
005528214.pdf
 
009586150.pdf
009586150.pdf009586150.pdf
009586150.pdf
 
009551323.pdf
009551323.pdf009551323.pdf
009551323.pdf
 
009723779.pdf
009723779.pdf009723779.pdf
009723779.pdf
 
005443266.pdf
005443266.pdf005443266.pdf
005443266.pdf
 

Dernier

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 

Dernier (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

005432796.pdf

  • 1. Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages
  • 2. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 1: Introduction to JavaServer Pages
  • 3. Objectives • Define JavaServer Pages (JSP) • Define Java servlets • Define Enterprise JavaBeans (EJB) • Compare JSP to other server-side programming environments • Explain the advantages of JSP • Understand the mechanics of JSP documents • Use basic JSP syntax • Describe how to invoke JSP documents
  • 4. What Is Enterprise JavaBeans (EJB)? • EJB = An architecture for deploying component-based distributed applications – J2EE-compliant application servers
  • 5. What Are Java Servlets? • Java servlets provide the functionality of the CGI for Java-driven Web applications – Managed and executed on a Web server that provides a servlet container – Executed within a single JVM and server process
  • 6. What Is JSP? • Server-side programming environment – Contains normal HTML with special syntax that allows dynamic content
  • 7. Web Application Technologies • Common Gateway Interface (CGI) • Server extensions • Server-side scripting – ColdFusion – PHP Hypertext Preprocessor (PHP)
  • 8. JSP Advantages and Mechanics • Java = powerful programming language – Built-in APIs • JSP applications are portable • JSP engine  locates the JSP document • JSP engine  processes the JSP document into a servlet • JSP engine  passes control to servlet engine
  • 9. Basic JSP Syntax • Script blocks <% //Java code %> • JSP files with comments <%-- JSP comment --%>
  • 10. Summary  Define JavaServer Pages (JSP)  Define Java servlets  Define Enterprise JavaBeans (EJB)  Compare JSP to other server-side programming environments  Explain the advantages of JSP  Understand the mechanics of JSP documents  Use basic JSP syntax  Describe how to invoke JSP documents
  • 11. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 2: JSP Fundamentals
  • 12. Objectives • Describe various styles of JSP syntax • Use JSP expressions • Use JSP scriptlets • Use JSP declarations • Use predefined variables
  • 14. Using JSP Scriptlets • Scriptlets allow you to: – Perform complex operations within a JSP document – Intersperse blocks of Java code with normal HTML
  • 15. Using JSP Declarations • JSP declarations: – Provide a construct in which to declare methods and variables – Do not produce output – Use the following syntax: <%! //Java code %>
  • 16. Using JSP Predefined Variables • The request variable • The response variable • The out variable • The application variable • The session variable • The config variable • The pageContext variable • The page variable
  • 17. Summary  Describe various styles of JSP syntax  Use JSP expressions  Use JSP scriptlets  Use JSP declarations  Use predefined variables
  • 18. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 3: JSP Directives
  • 19. Objectives • Define JSP directives • Use the page directive • Use page directive attributes • Use the include directive • Use the jsp:include element • Add and manipulate Java applets in JSP files using the jsp:plugin element
  • 20. Introduction to JSP Directives • The page directive – The import attribute – The language attribute – The contentType attribute – The pageEncoding attribute – The extends attribute – The isThreadSafe attribute – The session attribute – The buffer attribute – The autoFlush attribute – The errorPage attribute – The isErrorPage attribute – The info attribute
  • 21. Including Files in JSP • Using the include directive • Using the jsp:include element
  • 22. Using the jsp:plugin Element • The jsp:plugin element is used to: – Add Java applets to JSP files – Determine the appropriate tag for the client browser accessing the JSP file
  • 23. Summary  Define JSP directives  Use the page directive  Use page directive attributes  Use the include directive  Use the jsp:include element  Add and manipulate Java applets in JSP files using the jsp:plugin element
  • 24. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 4: JSP and JavaBeans
  • 25. Objectives • Define JavaBeans • Explain the concept of component-centric architecture • Describe the advantages of JavaBeans • Instantiate JavaBeans • Use JSP-JavaBeans tags to access and manipulate JavaBeans properties • Explain the conventions for constructing JavaBeans • Use the serializable interface • Access JavaBeans through scripting elements
  • 26. Component-Centric Architecture • Component-centric architecture: – Allows for handling complexity – Divides complex systems into components
  • 28. JSP—JavaBeans Tags Tag Description <jsp:useBean> Used to instantiate a JavaBean and create a reference to it <jsp:getProperty> Used to access a JavaBean property <jsp:setProperty> Used to modify a JavaBean property
  • 29. Rules for Constructing JavaBeans • Class • Constructor • Property • Methods – Regular methods – Access methods
  • 30. The JavaBean Serializable Interface • When a JavaBean is serialized, its property values are frozen • To make the JavaBean serializable, it should implement the Serializable interface
  • 31. Accessing JavaBeans Through Scriptlets and Expressions • After the <jsp:useBean> tag instantiates a JavaBean and has a reference to it, the JavaBean can be used in scriptlets and expressions throughout the scope of the JavaBean
  • 32. Summary  Define JavaBeans  Explain the concept of component-centric architecture  Describe the advantages of JavaBeans  Instantiate JavaBeans  Use JSP-JavaBeans tags to access and manipulate JavaBeans properties  Explain the conventions for constructing JavaBeans  Use the serializable interface  Access JavaBeans through scripting elements
  • 33. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 5: JSP Custom Tags and Tag Libraries
  • 34. Objectives • Describe JSP custom tags • Explain the need for JSP tag libraries • Define and use the taglib directive • Download, install and use a tag library • Create custom handler classes and descriptor files • Create tag attributes • Use a custom tag • Deploy tag libraries
  • 35. Why Use Tag Libraries? • Custom tag libraries: – Allow you to create complex objects that can be used by JSP developers – Allow you to reuse code across multiple JSP applications
  • 36. Using Custom Tags • Using a tag library – The number of pre-existing tag libraries is growing
  • 37. Creating JSP Custom Tag Libraries • Three steps to creating a custom tag: – Define a tag handler class – Define a tag library descriptor – Define a JSP page that uses the custom tag • The taglib directive
  • 38. Using Custom Tags in JSP Files • Key elements of a custom tag: – Tag name – Attributes – Nesting – Body content
  • 40. Tag Library Descriptor • Root element = <taglib> • Subelements = tlibversion shortname info • Deploying tag libraries
  • 41. Summary  Describe JSP custom tags  Explain the need for JSP tag libraries  Define and use the taglib directive  Download, install and use a tag library  Create custom handler classes and descriptor files  Create tag attributes  Use a custom tag  Deploy tag libraries
  • 42. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 6: JSP and Java Servlets
  • 43. Objectives • Define servlets • Write simple servlets • Discuss the difference between servlets and JSPs • Explain the concept of MVC design pattern • Describe the layers of MVC design pattern • Explain Models 1 and 2 Web application designs • Define the RequestDispatcher interface • Use the RequestDispatcher to dispatch requests
  • 44. Servlets • Java servlets = Java classes that implement the javax.servlet.Servlet interface • Servlets have no main method for handling requests – Using the GET method
  • 45. Servlets vs. JSP • Manageability problems with servlets • How can JSP help?
  • 46. Web Application Architecture • Presentation layer • Application layer • Control layer
  • 48. JSP vs. Servlet Architecture • Model 1 architecture • Model 2 architecture • Model 1 and Model 2 architecture trade-offs
  • 53. Controlling the Flow with RequestDispatcher • Acquiring a RequestDispatcher object • Using the RequestDispatcher object • Where to place the servlets • Incorporating another resource's output in a servlet • Forwarding a request from a JSP to other resources
  • 54. Summary  Define servlets  Write simple servlets  Discuss the difference between servlets and JSPs  Explain the concept of MVC design pattern  Describe the layers of MVC design pattern  Explain Models 1 and 2 Web application designs  Define the RequestDispatcher interface  Use the RequestDispatcher to dispatch requests
  • 55. Copyright © 2002 ProsoftTraining. All rights reserved. Lesson 7: JSP, HTML Forms and Databases
  • 56. Objectives • Describe the tiers in a three-tier distributed application • Discuss a Web communication between tiers • Use HTML forms and their input elements • Use the request object to communicate between HTML forms and JSP files • Explain the concept of relational databases • Use the main SQL statements • Describe Java Database Connectivity • Connect to a database and access information • Create an example of an HTML form
  • 57. Distributed Multi-Tiered Applications • Client tier • Server tier • Database tier
  • 58. Steps in a Typical Web Communication http://java.sun.com/getjava/download.html Hypertext Transfer Protocol Host name Path name
  • 59. HTML Forms • Text field input • Radio button input • Check box input • Drop-down menu input • Reset and submit buttons
  • 60. Request Object • Contains: – Methods for storing and retrieving attribute values – Methods for accessing request parameters – Methods for retrieving request headers – Methods for other uses
  • 61. Relational Databases • Database Management System (DBMS) • Queries
  • 62. Structured Query Language (SQL) • Data Definition Language (DDL) • Data Manipulation Language (DML) • Data Control Language (DCL)
  • 63. Java Database Connectivity (JDBC) • Load a JDBC driver • Connect to a database • Execute SQL statements • Disconnect from a database
  • 64. Summary  Describe the tiers in a three-tier distributed application  Discuss a Web communication between tiers  Use HTML forms and their input elements  Use the request object to communicate between HTML forms and JSP files  Explain the concept of relational databases  Use the main SQL statements  Describe Java Database Connectivity  Connect to a database and access information  Create an example of an HTML form
  • 65. JavaServer Pages  Introduction to JavaServer Pages  JSP Fundamentals  JSP Directives  JSP and JavaBeans  JSP Custom Tags and Tag Libraries  JSP and Java Servlets  JSP, HTML Forms and Databases