SlideShare a Scribd company logo
Core Web Application
Development Using Servlet &
JSP
Bahaa Farouk
                       Organized
                          By
Agenda
• Servlet
   – What is Java Servlet?
   – Servlet Life Cycle
   – Client Interaction & Session
• JSP
   –   What’s JSP?
   –   JSP Life Cycle
   –   What’s JSP Contains?
   –   JSP Scope & Implicit Objects
• Why Servlet & JSP?
Web Application Development?
Agenda
• Servlet
   – What is Java Servlet?
   – Servlet Life Cycle
   – Client Interaction & Session
• JSP
   –   What’s JSP?
   –   JSP Life Cycle
   –   What’s JSP Contains?
   –   JSP Scope & Implicit Objects
• Why Servlet & JSP?
What is Java Servlet?
• An alternate form of server-side computation that
  uses Java
• The Web server is extended to support an API, and
  then Java programs use the API to create dynamic
  web pages
• Using Java servlets provides a platform-independent
  replacement for CGI scripts.
• Servlets can be embedded in many different servers
  because the servlet API, which you use to write
  servlets, assumes nothing about the server's
  environment or protocol.
Servlet Life Cycle
• Initialization
   – the servlet engine loads the servlet’s *.class file in the JVM
     memory space and initializes any objects
• Execution
   – when a servlet request is made,
      • a ServletRequest object is sent with all information about the
        request
      • a ServletResponse object is used to return the response
• Destruction
   – the servlet cleans up allocated resources and shuts down
Client Interaction
• When a servlet accepts a call from a client,
  it receives two objects:
  – A ServletRequest, which encapsulates the
    communication from the client to the server.
  – A ServletResponse, which encapsulates the
    communication from the servlet back to the
    client.
• ServletRequest and ServletResponse are
  interfaces defined by the javax.servlet
  package.
Request Header Example
Request Parameters
Cookies
Session Capabilities
• Session tracking is a mechanism that servlets use to
  maintain state about a series of requests from the
  same user(that is, requests originating from the
  same browser) across some period of time.
• Session tracking capabilities. The servlet writer can
  use these APIs to maintain state between the servlet
  and the client that persists across multiple
  connections during some time period.
Sessions
Agenda
• Servlet
   – What is Java Servlet?
   – Servlet Life Cycle
   – Client Interaction & Session
• JSP
   –   What’s JSP?
   –   JSP Life Cycle
   –   What’s JSP Contains?
   –   JSP Scope & Implicit Objects
• Why Servlet & JSP?
What is JSP?
• A Java Servlet is a Java program that is run on the
  server
   – There are Java classes for retrieving HTTP requests and
     returning HTTP responses
   – Must return an entire HTML page, so all tuning of the page
     must be done in a Java program that needs to be re-
     compiled
• Java Server Pages (JSP)
   – use HTML and XML tags to design the page and JSP scriplet
     tags to generate dynamic content (Easier for separation
     between designer & developer)
   – use Java Beans and useful built-in objects for more
     convenience
JSP Life Cycle
• JSP page (MyFirstJSP.jsp)
   –   Translated to Servle (MyFirstJSP.servlet)
   –   Compiled to class (MyFirstJSP.class)
   –   Loaded into memory (Initialization)
   –   Execution (repeats)
   –   Destruction


• Any change in JSP page automatically repeats the
  whole life cycle.
Introduction
 • A Java Servlet is a Java program that is run on the
   server
    – There are Java classes for retrieving HTTP requests and
      returning HTTP responses
 • Java Server Pages (JSP)
    – use HTML and XML tags to design the page and JSP scriplet
      tags to generate dynamic content
    – use Java Beans, which are reusable components that are
      invoked by scriplets
What do JSPs contain?
• Template data
  – Everything other than elements (eg. Html tags)
• Elements
  – based on XML syntax
     • <somejsptag attribute name=“atrribute value”> BODY
       </somejsptag>
  – Directives
  – Scripting
     • Declarations
     • Scriptles
     • Expressions
  – Standard Actions
Directives
 • <%@ directivename attribute=“value”
   attribute=“value” %>
 • The page directive
    – <%@ page ATTRIBUTES %>
    – language, import, Buffer, errorPage,…
    – <%@ page languange=“java”
      import=“java.rmi.*,java.util.*” %>
 • The include directive
    – <%@ include file=“Filename” %>
    – the static file name to include (included at translation
      time)
 • The taglib directive
    – <% taglib uri=“taglibraryURI” prefix=“tagPrefix” %>
Scripting
(Declaration, Expressions, Scriptlets)
 • <%! . . %> declares variables or methods
    – define class-wide variables
    – <%! int i = 0; %>
    – <%! int a, b; double c: %>
    – <%! Circle a = new Circle(2.0); %>
    – You must declare a variable or method in a jsp page before
      you use it
    – The scope of a declaration is the jsp file, extending to all
      includes

 • <%= . . %> defines an expression and casts the result
   as a string
Scripting II
  • <%= . . %> can contain any language expression, but
    without a semicolon, e.g.
  • <%= Math.sqrt(2) %>
  • <%= items[I] %>
  • <%= a + b + c %>
  • <%= new java.util.Date() %>
  • <% . . %> can handle declarations (page scope),
    expressions, or any other type of code fragment
  • <% for(int I = 0; I < 10; I++) {
        out.println(“<B> Hello World: “ + I);       } %>
JSP and Scope
• Page - objects with page scope are accessible only within the
  page where they are created
• Request - objects with request scope are accessible from
  pages processing the same request where they were created
• Session - ojbects with session scope are accessible from pages
  processing requests that are in the same session as the one in
  which they were created
• Application - objects with application scope are accessible
  from pages processing requests that are in the same
  application as the one in which they were created
• All the different scopes behave as a single name space
Implicit Objects
• These objects do not need to be declared or instantiated by
  the JSP author, but are provided by the container (jsp engine)
  in the implementation class
• request Object (javax.servlet.ServletRequest)
• response Object (javax.servlet.ServletResponse)
• session Object (javax.servlet.http.HttpSession)
• application Object
• out Object
• config Object
• page Object
• pageContext Object (javax.servlet.jsp.PageContext)
• exception
Number guess - Browser Output
Agenda
• Servlet
   – What is Java Servlet?
   – Servlet Life Cycle
   – Client Interaction & Session
• JSP
   –   What’s JSP?
   –   JSP Life Cycle
   –   What’s JSP Contains?
   –   JSP Scope & Implicit Objects
• Why Servlet & JSP?
Why Servlet/JSP?
What is an Enterprise Application?
 •   Reliable
 •   Scalable
 •   Maintainable
 •   Manageable

     – If you are developing an Enterprise Application for
     whose daily transactions are millions?
        • Performance? Scalability? Reliability?
Questions ?

More Related Content

What's hot

Servlets
ServletsServlets
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
deepak kumar
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packagesvamsi krishna
 
Servlet
Servlet Servlet
Servlet
Dhara Joshi
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1vikram singh
 
Java servlets
Java servletsJava servlets
Java servletslopjuan
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
Emprovise
 
Java Servlets
Java ServletsJava Servlets
Java ServletsNitin Pai
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
Dhruvin Nakrani
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
Minal Maniar
 
Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servlets
JavaEE Trainers
 
Servlets
ServletsServlets
Java servlets
Java servletsJava servlets
Java servlets
Mukesh Tekwani
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
VMahesh5
 
Servlet and JSP
Servlet and JSPServlet and JSP
Servlet and JSP
Gary Yeh
 
Java EE 01-Servlets and Containers
Java EE 01-Servlets and ContainersJava EE 01-Servlets and Containers
Java EE 01-Servlets and Containers
Fernando Gil
 

What's hot (20)

Servlets
ServletsServlets
Servlets
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
Servlet
Servlet Servlet
Servlet
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 
Java servlets
Java servletsJava servlets
Java servlets
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servlets
 
Servlets
ServletsServlets
Servlets
 
Java servlets
Java servletsJava servlets
Java servlets
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlets
ServletsServlets
Servlets
 
Servlet and JSP
Servlet and JSPServlet and JSP
Servlet and JSP
 
Java EE 01-Servlets and Containers
Java EE 01-Servlets and ContainersJava EE 01-Servlets and Containers
Java EE 01-Servlets and Containers
 

Viewers also liked

M-Brokrage
M-BrokrageM-Brokrage
M-Brokrage
Bahaa Farouk
 
Be Part Of Software Development
Be Part Of Software DevelopmentBe Part Of Software Development
Be Part Of Software Development
Bahaa Farouk
 
QualiTech Profile
QualiTech ProfileQualiTech Profile
QualiTech Profile
Bahaa Farouk
 
Career building and Skills Development
Career building and Skills DevelopmentCareer building and Skills Development
Career building and Skills Development
Bahaa Farouk
 
Being Architect
Being ArchitectBeing Architect
Being Architect
Bahaa Farouk
 
SCRUM Development Process
SCRUM Development ProcessSCRUM Development Process
SCRUM Development ProcessBahaa Farouk
 
System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...
System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...
System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...
Ravindu Sandeepa
 
Scrum Agile Methodlogy
Scrum Agile MethodlogyScrum Agile Methodlogy
Scrum Agile Methodlogy
Bahaa Farouk
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
hchen1
 
Web Application Development
Web Application DevelopmentWeb Application Development
Web Application Development
Whytespace Ltd.
 
Oracle ADF Overview
Oracle ADF OverviewOracle ADF Overview
Oracle ADF OverviewBahaa Farouk
 
Agile Overview Session
Agile Overview SessionAgile Overview Session
Agile Overview Session
Bahaa Farouk
 
ESB Overview
ESB OverviewESB Overview
ESB Overview
Bahaa Farouk
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
Mohammed Makhlouf
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Web Development on Web Project Presentation
Web Development on Web Project PresentationWeb Development on Web Project Presentation
Web Development on Web Project Presentation
Milind Gokhale
 
Ppt of web development
Ppt of web developmentPpt of web development
Ppt of web developmentbethanygfair
 
Website Development and Design Proposal
Website Development and Design ProposalWebsite Development and Design Proposal
Website Development and Design Proposal
Creative 3D Design
 
java Project report online banking system
java Project report online banking systemjava Project report online banking system
java Project report online banking system
VishNu KuNtal
 

Viewers also liked (19)

M-Brokrage
M-BrokrageM-Brokrage
M-Brokrage
 
Be Part Of Software Development
Be Part Of Software DevelopmentBe Part Of Software Development
Be Part Of Software Development
 
QualiTech Profile
QualiTech ProfileQualiTech Profile
QualiTech Profile
 
Career building and Skills Development
Career building and Skills DevelopmentCareer building and Skills Development
Career building and Skills Development
 
Being Architect
Being ArchitectBeing Architect
Being Architect
 
SCRUM Development Process
SCRUM Development ProcessSCRUM Development Process
SCRUM Development Process
 
System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...
System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...
System requirement specification report(srs) T/TN/Gomarankadawala Maha vidyal...
 
Scrum Agile Methodlogy
Scrum Agile MethodlogyScrum Agile Methodlogy
Scrum Agile Methodlogy
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Web Application Development
Web Application DevelopmentWeb Application Development
Web Application Development
 
Oracle ADF Overview
Oracle ADF OverviewOracle ADF Overview
Oracle ADF Overview
 
Agile Overview Session
Agile Overview SessionAgile Overview Session
Agile Overview Session
 
ESB Overview
ESB OverviewESB Overview
ESB Overview
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
 
Web Development on Web Project Presentation
Web Development on Web Project PresentationWeb Development on Web Project Presentation
Web Development on Web Project Presentation
 
Ppt of web development
Ppt of web developmentPpt of web development
Ppt of web development
 
Website Development and Design Proposal
Website Development and Design ProposalWebsite Development and Design Proposal
Website Development and Design Proposal
 
java Project report online banking system
java Project report online banking systemjava Project report online banking system
java Project report online banking system
 

Similar to Core web application development

Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00Rajesh Moorjani
 
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 Server Pages
Java Server PagesJava Server Pages
Java Server Pages
Shah Nawaz Bhurt
 
18CSC311J Web Design and Development UNIT-3
18CSC311J Web Design and Development UNIT-318CSC311J Web Design and Development UNIT-3
18CSC311J Web Design and Development UNIT-3
sivakumarmcs
 
Jsp basic
Jsp basicJsp basic
Jsp basic
Jaya Kumari
 
Jsp
JspJsp
Jsp
JspJsp
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
Vipin Yadav
 
Advance java session 9
Advance java session 9Advance java session 9
Advance java session 9
Smita B Kumar
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
Prince Soni
 
Jsp
JspJsp
Advance java session 10
Advance java session 10Advance java session 10
Advance java session 10
Smita B Kumar
 
Java Servlets.pdf
Java Servlets.pdfJava Servlets.pdf
Java Servlets.pdf
Arumugam90
 
Ch. 7 beeing a jsp
Ch. 7 beeing a jsp     Ch. 7 beeing a jsp
Ch. 7 beeing a jsp
Manolis Vavalis
 
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
 
005432796.pdf
005432796.pdf005432796.pdf
005432796.pdf
EidTahir
 

Similar to Core web application development (20)

Coursejspservlets00
Coursejspservlets00Coursejspservlets00
Coursejspservlets00
 
Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00
 
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 Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
18CSC311J Web Design and Development UNIT-3
18CSC311J Web Design and Development UNIT-318CSC311J Web Design and Development UNIT-3
18CSC311J Web Design and Development UNIT-3
 
Jsp basic
Jsp basicJsp basic
Jsp basic
 
20jsp
20jsp20jsp
20jsp
 
Jsp
JspJsp
Jsp
 
Jsp
JspJsp
Jsp
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
 
Advance java session 9
Advance java session 9Advance java session 9
Advance java session 9
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
 
Jsp
JspJsp
Jsp
 
Advance java session 10
Advance java session 10Advance java session 10
Advance java session 10
 
Java Servlets.pdf
Java Servlets.pdfJava Servlets.pdf
Java Servlets.pdf
 
Ch. 7 beeing a jsp
Ch. 7 beeing a jsp     Ch. 7 beeing a jsp
Ch. 7 beeing a jsp
 
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
 
005432796.pdf
005432796.pdf005432796.pdf
005432796.pdf
 

Recently uploaded

Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 

Recently uploaded (20)

Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 

Core web application development

  • 1. Core Web Application Development Using Servlet & JSP Bahaa Farouk Organized By
  • 2. Agenda • Servlet – What is Java Servlet? – Servlet Life Cycle – Client Interaction & Session • JSP – What’s JSP? – JSP Life Cycle – What’s JSP Contains? – JSP Scope & Implicit Objects • Why Servlet & JSP?
  • 4. Agenda • Servlet – What is Java Servlet? – Servlet Life Cycle – Client Interaction & Session • JSP – What’s JSP? – JSP Life Cycle – What’s JSP Contains? – JSP Scope & Implicit Objects • Why Servlet & JSP?
  • 5. What is Java Servlet? • An alternate form of server-side computation that uses Java • The Web server is extended to support an API, and then Java programs use the API to create dynamic web pages • Using Java servlets provides a platform-independent replacement for CGI scripts. • Servlets can be embedded in many different servers because the servlet API, which you use to write servlets, assumes nothing about the server's environment or protocol.
  • 6. Servlet Life Cycle • Initialization – the servlet engine loads the servlet’s *.class file in the JVM memory space and initializes any objects • Execution – when a servlet request is made, • a ServletRequest object is sent with all information about the request • a ServletResponse object is used to return the response • Destruction – the servlet cleans up allocated resources and shuts down
  • 7. Client Interaction • When a servlet accepts a call from a client, it receives two objects: – A ServletRequest, which encapsulates the communication from the client to the server. – A ServletResponse, which encapsulates the communication from the servlet back to the client. • ServletRequest and ServletResponse are interfaces defined by the javax.servlet package.
  • 11. Session Capabilities • Session tracking is a mechanism that servlets use to maintain state about a series of requests from the same user(that is, requests originating from the same browser) across some period of time. • Session tracking capabilities. The servlet writer can use these APIs to maintain state between the servlet and the client that persists across multiple connections during some time period.
  • 13. Agenda • Servlet – What is Java Servlet? – Servlet Life Cycle – Client Interaction & Session • JSP – What’s JSP? – JSP Life Cycle – What’s JSP Contains? – JSP Scope & Implicit Objects • Why Servlet & JSP?
  • 14. What is JSP? • A Java Servlet is a Java program that is run on the server – There are Java classes for retrieving HTTP requests and returning HTTP responses – Must return an entire HTML page, so all tuning of the page must be done in a Java program that needs to be re- compiled • Java Server Pages (JSP) – use HTML and XML tags to design the page and JSP scriplet tags to generate dynamic content (Easier for separation between designer & developer) – use Java Beans and useful built-in objects for more convenience
  • 15. JSP Life Cycle • JSP page (MyFirstJSP.jsp) – Translated to Servle (MyFirstJSP.servlet) – Compiled to class (MyFirstJSP.class) – Loaded into memory (Initialization) – Execution (repeats) – Destruction • Any change in JSP page automatically repeats the whole life cycle.
  • 16. Introduction • A Java Servlet is a Java program that is run on the server – There are Java classes for retrieving HTTP requests and returning HTTP responses • Java Server Pages (JSP) – use HTML and XML tags to design the page and JSP scriplet tags to generate dynamic content – use Java Beans, which are reusable components that are invoked by scriplets
  • 17. What do JSPs contain? • Template data – Everything other than elements (eg. Html tags) • Elements – based on XML syntax • <somejsptag attribute name=“atrribute value”> BODY </somejsptag> – Directives – Scripting • Declarations • Scriptles • Expressions – Standard Actions
  • 18. Directives • <%@ directivename attribute=“value” attribute=“value” %> • The page directive – <%@ page ATTRIBUTES %> – language, import, Buffer, errorPage,… – <%@ page languange=“java” import=“java.rmi.*,java.util.*” %> • The include directive – <%@ include file=“Filename” %> – the static file name to include (included at translation time) • The taglib directive – <% taglib uri=“taglibraryURI” prefix=“tagPrefix” %>
  • 19. Scripting (Declaration, Expressions, Scriptlets) • <%! . . %> declares variables or methods – define class-wide variables – <%! int i = 0; %> – <%! int a, b; double c: %> – <%! Circle a = new Circle(2.0); %> – You must declare a variable or method in a jsp page before you use it – The scope of a declaration is the jsp file, extending to all includes • <%= . . %> defines an expression and casts the result as a string
  • 20. Scripting II • <%= . . %> can contain any language expression, but without a semicolon, e.g. • <%= Math.sqrt(2) %> • <%= items[I] %> • <%= a + b + c %> • <%= new java.util.Date() %> • <% . . %> can handle declarations (page scope), expressions, or any other type of code fragment • <% for(int I = 0; I < 10; I++) { out.println(“<B> Hello World: “ + I); } %>
  • 21. JSP and Scope • Page - objects with page scope are accessible only within the page where they are created • Request - objects with request scope are accessible from pages processing the same request where they were created • Session - ojbects with session scope are accessible from pages processing requests that are in the same session as the one in which they were created • Application - objects with application scope are accessible from pages processing requests that are in the same application as the one in which they were created • All the different scopes behave as a single name space
  • 22. Implicit Objects • These objects do not need to be declared or instantiated by the JSP author, but are provided by the container (jsp engine) in the implementation class • request Object (javax.servlet.ServletRequest) • response Object (javax.servlet.ServletResponse) • session Object (javax.servlet.http.HttpSession) • application Object • out Object • config Object • page Object • pageContext Object (javax.servlet.jsp.PageContext) • exception
  • 23. Number guess - Browser Output
  • 24. Agenda • Servlet – What is Java Servlet? – Servlet Life Cycle – Client Interaction & Session • JSP – What’s JSP? – JSP Life Cycle – What’s JSP Contains? – JSP Scope & Implicit Objects • Why Servlet & JSP?
  • 25. Why Servlet/JSP? What is an Enterprise Application? • Reliable • Scalable • Maintainable • Manageable – If you are developing an Enterprise Application for whose daily transactions are millions? • Performance? Scalability? Reliability?