SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Web Component Development Using
Servlet & JSP Technologies (EE6)
Module -1: Introduction to Java Servlet
www.webstackacademy.com
www.webstackacademy.com
Objectives
Upon completion of this module, you should be able to:
● Outline Java Servlet technology
www.webstackacademy.com
Relevance
● Discussion – The following questions are relevant to understanding
what technologies are available for developing web applications and
the limitations of those technologies:
– What web applications have you developed?
– Did your web technology allow you to achieve your goals?
www.webstackacademy.com
HTTP Client-Server
Architecture
HTTP Daemon is a software program that runs in the background of a web server and
waits for the incoming server requests. The daemon answers the request automatically and
serves the hypertext and multimedia documents over the internet using HTTP.
www.webstackacademy.com
Web Application
Directory Structure
www.webstackacademy.com
Uniform Resource
Locator (URL)
protocol://host:port/path/file
http://www.soccer.org:80/league/Spring2001.html
● A URL locates a specific resource on the Internet.
● The path element includes the complete directory structure path to
find the file.
● The port number is used to identify the port that is used by the
protocol on the server.
● If the port number is the standard port for the given protocol, then that
number can be ignored in the URL
www.webstackacademy.com
Web Sites and Web
Applications
● A web site is a collection of static files, HTML pages, graphics, and
various other files.
● A web application is an element of a web site that provides dynamic
functionality on the server.
● A web application runs a program or programs on the server.
www.webstackacademy.com
Common Gateway Interface
(CGI)
● The Common Gateway Interface, which is normally referred
as CGI, was one of the practical technique developed for
creating dynamic content.
● By using the CGI, a web server passes requests to an
external program and after executing the program the
content is sent to the client as the output.
● In CGI when a server receives a request it creates a new
process to run the CGI program, so creating a process for
each request requires significant server resources and time,
which limits the number of requests that can be processed
concurrently.
www.webstackacademy.com
Common Gateway Interface
(CGI)
● CGI applications are platform dependent.
● There is no doubt that CGI played a major role in the explosion of the
Internet but its performance, scalability issues make it less than
optimal solutions.
www.webstackacademy.com
Advantages of CGI
Programs
● CGI programs have the following advantages:
– Programs can be written in a variety of languages, although they
are primarily written in Perl.
– A CGI program with bugs does not crash the web server.
– Because CGI programs execute in separate processes,
concurrency issues are isolated at the database.
– CGI support is very common.
www.webstackacademy.com
Disadvantages of CGI
Programs
● CGI program also have the following distinct disadvantages:
● The response time of CGI programs is high because the creation of a
new process is a heavyweight activity for the operating system (OS).
● CGI does not scale well.
● The languages for CGI are not always secure or object-oriented.
● The CGI script has to generate an HTML response,so the CGI code
is mingled with HTML. This is not good separation of presentation
and business logic.
www.webstackacademy.com
Java Servlets
● Unlike CGI, Servlets don't use multiple processes to handle separate
request.
● Servets can be handled by separate threads within the same
process. Servlets are also portable and platform independent.
● Servlets are used with web servers and run inside a Java Virtual
Machine (JVM) on the server so these are safe and portable.
www.webstackacademy.com
Java Servlets
www.webstackacademy.com
Advantages of Java Servlets
●
Each request is run in a separate thread within a single process, so servlet
request processing is significantly faster than traditional CGI processing.
● Servlets are much more scalable than CGI. Many more requests can be
executed because the web container uses a thread rather than an OS
process. Threads are lightweight and the host OS can support many more
of them.
● Servlets benefit from the simple, robust, platform independent, and object-
oriented nature of the Java programming language.
●
Servlets have access to standardized and easy-to-use logging capabilities.
●
The web container provides additional services to the servlets, such
as error handling and security.
www.webstackacademy.com
Disadvantages of Java
Servlets
● Servlets can only be written in the Java programming language, so
developers are required to be competent with this language.
● Servlets might introduce new concurrency issues not found in CGI.
www.webstackacademy.com
Java Servlet Recap
● Servlets run within the Java Platform Enterprise Edition (Java EE)
component container architecture.
● This container is called the web container (also known as the servlet
engine).
● The web container is a JavaTM technology program that implements
the servlet application programming interface (API)
● Servlets are components that respond to HTTP requests.
● The web container performs initial processing, and selects the
intended servlet to handle the request.
● The container also controls the life-cycle of the servlet.
www.webstackacademy.com
Web Server Architecture
With Java Servlets
www.webstackacademy.com
A First Java Servlet
● A servlet is invoked by the web container when an appropriate request
is received by that container. In Java EE 6, an annotation specifies the
URL (or URL pattern) that the servlet is used to respond to.
● The method in the servlet that is invoked depends on the type of
HTTP request so, for example, an HTTP GET request will invoke the
doGet method in the servlet.
● The doGet method takes two parameters, one which carries
information related to the original request, and another which provides
for control of the response.
● The servlet’s job is two-fold. First, it must perform the required
computation; second, it must present the results in a well-formed
HTML page.
www.webstackacademy.com
The Code for a very
Simple Servlet
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class DemoServlet extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
res.setContentType("text/html");//setting the content type
PrintWriter pw=res.getWriter();//get the stream to write the data
}}
www.webstackacademy.com
HTTP Methods
● GET : Asks to get the resource at the requested URL.
● POST: Asks the server to accept the body info attached. It is like GET
request with extra info sent with the request.
● HEAD: Asks for only the header part of whatever a GET would
return. Just like GET but with no body.
● PUT: Asks for the loop back of the request message, for testing or
troubleshooting.
www.webstackacademy.com
HTTP Methods
● DELETE: Says to put the enclosed info (the body) at the requested
URL.
● OPTIONS: Says to delete the resource at the requested URL.
● TRACE: Asks for a list of the HTTP methods to which the thing at the
request URL can respond
Web Stack Academy (P) Ltd
#83, Farah Towers,
1st floor,MG Road,
Bangalore – 560001
M: +91-80-4128 9576
T: +91-98862 69112
E: info@www.webstackacademy.com
www.webstackacademy.com

Weitere ähnliche Inhalte

Was ist angesagt?

Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Noam Kfir
 
Why You Should Use MERN Stack for Startup Apps?
Why You Should Use MERN Stack for Startup Apps?Why You Should Use MERN Stack for Startup Apps?
Why You Should Use MERN Stack for Startup Apps?Pixel Crayons
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
Spring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSSpring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSVMware Tanzu
 
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalertsAhmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalertsShekh Muenuddeen
 
Glassfish An Introduction
Glassfish An IntroductionGlassfish An Introduction
Glassfish An IntroductionJumping Bean
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Steven Smith
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - IntroductionWebStackAcademy
 
ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015Shahed Chowdhuri
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkEdureka!
 
Setup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architectureSetup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architectureMindfire Solutions
 
ASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTMASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTMShahed Chowdhuri
 
Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4
Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4
Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4Sravan Lingam
 
Integration Testing with Behat drupal
Integration Testing with Behat drupalIntegration Testing with Behat drupal
Integration Testing with Behat drupalOscar Merida
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Ryan Cuprak
 

Was ist angesagt? (20)

Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
 
Why You Should Use MERN Stack for Startup Apps?
Why You Should Use MERN Stack for Startup Apps?Why You Should Use MERN Stack for Startup Apps?
Why You Should Use MERN Stack for Startup Apps?
 
Java FX Tools Aquarium Paris
Java FX Tools Aquarium ParisJava FX Tools Aquarium Paris
Java FX Tools Aquarium Paris
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
Spring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSSpring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWS
 
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalertsAhmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
 
Glassfish An Introduction
Glassfish An IntroductionGlassfish An Introduction
Glassfish An Introduction
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0
 
Weblogic - clustering failover, and load balancing
Weblogic - clustering failover, and load balancingWeblogic - clustering failover, and load balancing
Weblogic - clustering failover, and load balancing
 
Type script
Type scriptType script
Type script
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015ASP.NET 5 Overview - Post Build 2015
ASP.NET 5 Overview - Post Build 2015
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express Framework
 
Setup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architectureSetup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architecture
 
ASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTMASP.NET 5 Overview: Post RTM
ASP.NET 5 Overview: Post RTM
 
Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4
Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4
Hyd MuleSoft-Meetup-May 29,2021 | Migrating Mule 3 Java related code to Mule 4
 
Integration Testing with Behat drupal
Integration Testing with Behat drupalIntegration Testing with Behat drupal
Integration Testing with Behat drupal
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Ausoug glassfish perth
Ausoug glassfish perthAusoug glassfish perth
Ausoug glassfish perth
 

Ähnlich wie Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1 - Introduction to Java Servlet

Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music storeADEEBANADEEM
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet backdoor
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
 
WEB TECHNOLOGY Unit-3.pptx
WEB TECHNOLOGY Unit-3.pptxWEB TECHNOLOGY Unit-3.pptx
WEB TECHNOLOGY Unit-3.pptxkarthiksmart21
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 
Server side programming
Server side programming Server side programming
Server side programming javed ahmed
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technologyTanmoy Barman
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
 
Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Prashanth Shivakumar
 
Presentation on java servlets
Presentation on java servletsPresentation on java servlets
Presentation on java servletsAamir Sohail
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptxMattMarino13
 

Ähnlich wie Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1 - Introduction to Java Servlet (20)

Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
WEB TECHNOLOGY Unit-3.pptx
WEB TECHNOLOGY Unit-3.pptxWEB TECHNOLOGY Unit-3.pptx
WEB TECHNOLOGY Unit-3.pptx
 
Servlets
ServletsServlets
Servlets
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Server side programming
Server side programming Server side programming
Server side programming
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
JAVA
JAVAJAVA
JAVA
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01
 
Servlet classnotes
Servlet classnotesServlet classnotes
Servlet classnotes
 
Presentation on java servlets
Presentation on java servletsPresentation on java servlets
Presentation on java servlets
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptx
 

Mehr von WebStackAcademy

WSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per SecondWSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per SecondWebStackAcademy
 
WSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer CourseWSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer CourseWebStackAcademy
 
Career Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and OpportunitiesCareer Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and OpportunitiesWebStackAcademy
 
Webstack Academy - Internship Kick Off
Webstack Academy - Internship Kick OffWebstack Academy - Internship Kick Off
Webstack Academy - Internship Kick OffWebStackAcademy
 
Building Your Online Portfolio
Building Your Online PortfolioBuilding Your Online Portfolio
Building Your Online PortfolioWebStackAcademy
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career RoadmapWebStackAcademy
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationWebStackAcademy
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesWebStackAcademy
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationWebStackAcademy
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - DirectivesWebStackAcademy
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsWebStackAcademy
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming WebStackAcademy
 
JavaScript - Chapter 10 - Strings and Arrays
 JavaScript - Chapter 10 - Strings and Arrays JavaScript - Chapter 10 - Strings and Arrays
JavaScript - Chapter 10 - Strings and ArraysWebStackAcademy
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging TechniquesWebStackAcademy
 
JavaScript - Chapter 14 - Form Handling
 JavaScript - Chapter 14 - Form Handling   JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 14 - Form Handling WebStackAcademy
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)WebStackAcademy
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events WebStackAcademy
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
 

Mehr von WebStackAcademy (20)

WSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per SecondWSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Scaling Web Service to Handle Millions of Requests per Second
 
WSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer CourseWSA: Course Demo Webinar - Full Stack Developer Course
WSA: Course Demo Webinar - Full Stack Developer Course
 
Career Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and OpportunitiesCareer Building in AI - Technologies, Trends and Opportunities
Career Building in AI - Technologies, Trends and Opportunities
 
Webstack Academy - Internship Kick Off
Webstack Academy - Internship Kick OffWebstack Academy - Internship Kick Off
Webstack Academy - Internship Kick Off
 
Building Your Online Portfolio
Building Your Online PortfolioBuilding Your Online Portfolio
Building Your Online Portfolio
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career Roadmap
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase Integration
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
 
JavaScript - Chapter 10 - Strings and Arrays
 JavaScript - Chapter 10 - Strings and Arrays JavaScript - Chapter 10 - Strings and Arrays
JavaScript - Chapter 10 - Strings and Arrays
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
 
JavaScript - Chapter 14 - Form Handling
 JavaScript - Chapter 14 - Form Handling   JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 14 - Form Handling
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 

Kürzlich hochgeladen

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 

Kürzlich hochgeladen (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 

Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1 - Introduction to Java Servlet

  • 1. Web Component Development Using Servlet & JSP Technologies (EE6) Module -1: Introduction to Java Servlet
  • 3. www.webstackacademy.com Objectives Upon completion of this module, you should be able to: ● Outline Java Servlet technology
  • 4. www.webstackacademy.com Relevance ● Discussion – The following questions are relevant to understanding what technologies are available for developing web applications and the limitations of those technologies: – What web applications have you developed? – Did your web technology allow you to achieve your goals?
  • 5. www.webstackacademy.com HTTP Client-Server Architecture HTTP Daemon is a software program that runs in the background of a web server and waits for the incoming server requests. The daemon answers the request automatically and serves the hypertext and multimedia documents over the internet using HTTP.
  • 7. www.webstackacademy.com Uniform Resource Locator (URL) protocol://host:port/path/file http://www.soccer.org:80/league/Spring2001.html ● A URL locates a specific resource on the Internet. ● The path element includes the complete directory structure path to find the file. ● The port number is used to identify the port that is used by the protocol on the server. ● If the port number is the standard port for the given protocol, then that number can be ignored in the URL
  • 8. www.webstackacademy.com Web Sites and Web Applications ● A web site is a collection of static files, HTML pages, graphics, and various other files. ● A web application is an element of a web site that provides dynamic functionality on the server. ● A web application runs a program or programs on the server.
  • 9. www.webstackacademy.com Common Gateway Interface (CGI) ● The Common Gateway Interface, which is normally referred as CGI, was one of the practical technique developed for creating dynamic content. ● By using the CGI, a web server passes requests to an external program and after executing the program the content is sent to the client as the output. ● In CGI when a server receives a request it creates a new process to run the CGI program, so creating a process for each request requires significant server resources and time, which limits the number of requests that can be processed concurrently.
  • 10. www.webstackacademy.com Common Gateway Interface (CGI) ● CGI applications are platform dependent. ● There is no doubt that CGI played a major role in the explosion of the Internet but its performance, scalability issues make it less than optimal solutions.
  • 11. www.webstackacademy.com Advantages of CGI Programs ● CGI programs have the following advantages: – Programs can be written in a variety of languages, although they are primarily written in Perl. – A CGI program with bugs does not crash the web server. – Because CGI programs execute in separate processes, concurrency issues are isolated at the database. – CGI support is very common.
  • 12. www.webstackacademy.com Disadvantages of CGI Programs ● CGI program also have the following distinct disadvantages: ● The response time of CGI programs is high because the creation of a new process is a heavyweight activity for the operating system (OS). ● CGI does not scale well. ● The languages for CGI are not always secure or object-oriented. ● The CGI script has to generate an HTML response,so the CGI code is mingled with HTML. This is not good separation of presentation and business logic.
  • 13. www.webstackacademy.com Java Servlets ● Unlike CGI, Servlets don't use multiple processes to handle separate request. ● Servets can be handled by separate threads within the same process. Servlets are also portable and platform independent. ● Servlets are used with web servers and run inside a Java Virtual Machine (JVM) on the server so these are safe and portable.
  • 15. www.webstackacademy.com Advantages of Java Servlets ● Each request is run in a separate thread within a single process, so servlet request processing is significantly faster than traditional CGI processing. ● Servlets are much more scalable than CGI. Many more requests can be executed because the web container uses a thread rather than an OS process. Threads are lightweight and the host OS can support many more of them. ● Servlets benefit from the simple, robust, platform independent, and object- oriented nature of the Java programming language. ● Servlets have access to standardized and easy-to-use logging capabilities. ● The web container provides additional services to the servlets, such as error handling and security.
  • 16. www.webstackacademy.com Disadvantages of Java Servlets ● Servlets can only be written in the Java programming language, so developers are required to be competent with this language. ● Servlets might introduce new concurrency issues not found in CGI.
  • 17. www.webstackacademy.com Java Servlet Recap ● Servlets run within the Java Platform Enterprise Edition (Java EE) component container architecture. ● This container is called the web container (also known as the servlet engine). ● The web container is a JavaTM technology program that implements the servlet application programming interface (API) ● Servlets are components that respond to HTTP requests. ● The web container performs initial processing, and selects the intended servlet to handle the request. ● The container also controls the life-cycle of the servlet.
  • 19. www.webstackacademy.com A First Java Servlet ● A servlet is invoked by the web container when an appropriate request is received by that container. In Java EE 6, an annotation specifies the URL (or URL pattern) that the servlet is used to respond to. ● The method in the servlet that is invoked depends on the type of HTTP request so, for example, an HTTP GET request will invoke the doGet method in the servlet. ● The doGet method takes two parameters, one which carries information related to the original request, and another which provides for control of the response. ● The servlet’s job is two-fold. First, it must perform the required computation; second, it must present the results in a well-formed HTML page.
  • 20. www.webstackacademy.com The Code for a very Simple Servlet import javax.servlet.http.*; import javax.servlet.*; import java.io.*; public class DemoServlet extends HttpServlet{ public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentType("text/html");//setting the content type PrintWriter pw=res.getWriter();//get the stream to write the data }}
  • 21. www.webstackacademy.com HTTP Methods ● GET : Asks to get the resource at the requested URL. ● POST: Asks the server to accept the body info attached. It is like GET request with extra info sent with the request. ● HEAD: Asks for only the header part of whatever a GET would return. Just like GET but with no body. ● PUT: Asks for the loop back of the request message, for testing or troubleshooting.
  • 22. www.webstackacademy.com HTTP Methods ● DELETE: Says to put the enclosed info (the body) at the requested URL. ● OPTIONS: Says to delete the resource at the requested URL. ● TRACE: Asks for a list of the HTTP methods to which the thing at the request URL can respond
  • 23. Web Stack Academy (P) Ltd #83, Farah Towers, 1st floor,MG Road, Bangalore – 560001 M: +91-80-4128 9576 T: +91-98862 69112 E: info@www.webstackacademy.com www.webstackacademy.com