Suche senden
Hochladen
Overview of JEE Technology
•
2 gefällt mir
•
1,268 views
People Strategists
Folgen
JEE
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 49
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Hibernate I
Hibernate I
People Strategists
Hibernate II
Hibernate II
People Strategists
Spring Framework - III
Spring Framework - III
People Strategists
JSP Technology II
JSP Technology II
People Strategists
Spring Framework-II
Spring Framework-II
People Strategists
Hibernate III
Hibernate III
People Strategists
Working with Servlets
Working with Servlets
People Strategists
JSP Technology I
JSP Technology I
People Strategists
Empfohlen
Hibernate I
Hibernate I
People Strategists
Hibernate II
Hibernate II
People Strategists
Spring Framework - III
Spring Framework - III
People Strategists
JSP Technology II
JSP Technology II
People Strategists
Spring Framework-II
Spring Framework-II
People Strategists
Hibernate III
Hibernate III
People Strategists
Working with Servlets
Working with Servlets
People Strategists
JSP Technology I
JSP Technology I
People Strategists
Spring Framework -I
Spring Framework -I
People Strategists
Hibernate tutorial for beginners
Hibernate tutorial for beginners
Rahul Jain
Hibernate in Action
Hibernate in Action
Akshay Ballarpure
TY.BSc.IT Java QB U4
TY.BSc.IT Java QB U4
Lokesh Singrol
TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5
Lokesh Singrol
Hibernate presentation
Hibernate presentation
Manav Prasad
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
kamal kotecha
TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3
Lokesh Singrol
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6
Lokesh Singrol
Jdbc
Jdbc
Mallikarjuna G D
Hibernate Interview Questions
Hibernate Interview Questions
Syed Shahul
jpa-hibernate-presentation
jpa-hibernate-presentation
John Slick
Server side programming bt0083
Server side programming bt0083
Divyam Pateriya
Hibernate tutorial
Hibernate tutorial
Mumbai Academisc
Learn about dot net attributes
Learn about dot net attributes
sonia merchant
Hibernate ppt
Hibernate ppt
Aneega
Hibernate
Hibernate
Ajay K
24 collections framework interview questions
24 collections framework interview questions
Arun Vasanth
Intorduction to struts
Intorduction to struts
Anup72
Enterprice java
Enterprice java
GowriLatha1
Project report for final year project
Project report for final year project
suneel singh
Java EE 7 introduction
Java EE 7 introduction
Moumie Soulemane
Weitere ähnliche Inhalte
Was ist angesagt?
Spring Framework -I
Spring Framework -I
People Strategists
Hibernate tutorial for beginners
Hibernate tutorial for beginners
Rahul Jain
Hibernate in Action
Hibernate in Action
Akshay Ballarpure
TY.BSc.IT Java QB U4
TY.BSc.IT Java QB U4
Lokesh Singrol
TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5
Lokesh Singrol
Hibernate presentation
Hibernate presentation
Manav Prasad
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
kamal kotecha
TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3
Lokesh Singrol
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6
Lokesh Singrol
Jdbc
Jdbc
Mallikarjuna G D
Hibernate Interview Questions
Hibernate Interview Questions
Syed Shahul
jpa-hibernate-presentation
jpa-hibernate-presentation
John Slick
Server side programming bt0083
Server side programming bt0083
Divyam Pateriya
Hibernate tutorial
Hibernate tutorial
Mumbai Academisc
Learn about dot net attributes
Learn about dot net attributes
sonia merchant
Hibernate ppt
Hibernate ppt
Aneega
Hibernate
Hibernate
Ajay K
24 collections framework interview questions
24 collections framework interview questions
Arun Vasanth
Was ist angesagt?
(18)
Spring Framework -I
Spring Framework -I
Hibernate tutorial for beginners
Hibernate tutorial for beginners
Hibernate in Action
Hibernate in Action
TY.BSc.IT Java QB U4
TY.BSc.IT Java QB U4
TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5
Hibernate presentation
Hibernate presentation
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6
Jdbc
Jdbc
Hibernate Interview Questions
Hibernate Interview Questions
jpa-hibernate-presentation
jpa-hibernate-presentation
Server side programming bt0083
Server side programming bt0083
Hibernate tutorial
Hibernate tutorial
Learn about dot net attributes
Learn about dot net attributes
Hibernate ppt
Hibernate ppt
Hibernate
Hibernate
24 collections framework interview questions
24 collections framework interview questions
Ähnlich wie Overview of JEE Technology
Intorduction to struts
Intorduction to struts
Anup72
Enterprice java
Enterprice java
GowriLatha1
Project report for final year project
Project report for final year project
suneel singh
Java EE 7 introduction
Java EE 7 introduction
Moumie Soulemane
Java ee introduction
Java ee introduction
Moumie Soulemane
Java J2EE
Java J2EE
Sandeep Rawat
Java part 3
Java part 3
ACCESS Health Digital
Web programming and development - Introduction
Web programming and development - Introduction
Joel Briza
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
suranisaunak
Servlet by Rj
Servlet by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
J2EE Notes JDBC database Connectiviy and Programs related to JDBC
J2EE Notes JDBC database Connectiviy and Programs related to JDBC
ChaithraCSHirematt
J2 EEE SIDES
J2 EEE SIDES
bputhal
Online test management system
Online test management system
Prateek Agarwak
Introduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
Assignment3.2
Assignment3.2
Fina KHosravi
4. J2EE.pptx
4. J2EE.pptx
HariChandruduM
soa1.ppt
soa1.ppt
ShanmugamS34
Java Interview Questions
Java Interview Questions
anil_kumar132001
Framework adoption for java enterprise application development
Framework adoption for java enterprise application development
Clarence Ho
Naga Srinivas
Naga Srinivas
Bhaskar Naga Srinivas Repuri
Ähnlich wie Overview of JEE Technology
(20)
Intorduction to struts
Intorduction to struts
Enterprice java
Enterprice java
Project report for final year project
Project report for final year project
Java EE 7 introduction
Java EE 7 introduction
Java ee introduction
Java ee introduction
Java J2EE
Java J2EE
Java part 3
Java part 3
Web programming and development - Introduction
Web programming and development - Introduction
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
Servlet by Rj
Servlet by Rj
J2EE Notes JDBC database Connectiviy and Programs related to JDBC
J2EE Notes JDBC database Connectiviy and Programs related to JDBC
J2 EEE SIDES
J2 EEE SIDES
Online test management system
Online test management system
Introduction to ejb and struts framework
Introduction to ejb and struts framework
Assignment3.2
Assignment3.2
4. J2EE.pptx
4. J2EE.pptx
soa1.ppt
soa1.ppt
Java Interview Questions
Java Interview Questions
Framework adoption for java enterprise application development
Framework adoption for java enterprise application development
Naga Srinivas
Naga Srinivas
Mehr von People Strategists
MongoDB Session 3
MongoDB Session 3
People Strategists
MongoDB Session 2
MongoDB Session 2
People Strategists
MongoDB Session 1
MongoDB Session 1
People Strategists
Android - Day 1
Android - Day 1
People Strategists
Android - Day 2
Android - Day 2
People Strategists
Overview of web services
Overview of web services
People Strategists
Identifing Listeners and Filters
Identifing Listeners and Filters
People Strategists
Exploring Maven SVN GIT
Exploring Maven SVN GIT
People Strategists
Agile Dev. II
Agile Dev. II
People Strategists
Agile Dev. I
Agile Dev. I
People Strategists
XML Schemas
XML Schemas
People Strategists
JSON and XML
JSON and XML
People Strategists
Ajax and Jquery
Ajax and Jquery
People Strategists
CSS
CSS
People Strategists
HTML/HTML5
HTML/HTML5
People Strategists
JDBC
JDBC
People Strategists
RDBMS with MySQL
RDBMS with MySQL
People Strategists
Java Day-7
Java Day-7
People Strategists
Java Day-6
Java Day-6
People Strategists
Final Table of Content
Final Table of Content
People Strategists
Mehr von People Strategists
(20)
MongoDB Session 3
MongoDB Session 3
MongoDB Session 2
MongoDB Session 2
MongoDB Session 1
MongoDB Session 1
Android - Day 1
Android - Day 1
Android - Day 2
Android - Day 2
Overview of web services
Overview of web services
Identifing Listeners and Filters
Identifing Listeners and Filters
Exploring Maven SVN GIT
Exploring Maven SVN GIT
Agile Dev. II
Agile Dev. II
Agile Dev. I
Agile Dev. I
XML Schemas
XML Schemas
JSON and XML
JSON and XML
Ajax and Jquery
Ajax and Jquery
CSS
CSS
HTML/HTML5
HTML/HTML5
JDBC
JDBC
RDBMS with MySQL
RDBMS with MySQL
Java Day-7
Java Day-7
Java Day-6
Java Day-6
Final Table of Content
Final Table of Content
Kürzlich hochgeladen
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
rafiqahmad00786416
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Igalia
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
apidays
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Zilliz
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Deepika Singh
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
apidays
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
MadyBayot
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
Zilliz
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Remote DBA Services
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Edi Saputra
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
apidays
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
Kürzlich hochgeladen
(20)
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Overview of JEE Technology
1.
© People Strategists
www.peoplestrategists.com Slide 1 of 48 Overview of JEE Technologies
2.
© People Strategists
www.peoplestrategists.com Slide 2 of 48 Objectives In this session, you will learn to: Describe website and Web application Identify Enterprise Application Explore Servlet API
3.
© People Strategists
www.peoplestrategists.com Slide 3 of 48 A Web page is an electronic document, which is created using HTML and is translated by the Web browser. A Web pages can be : Static Dynamic A website is a collection of one or more Web pages, which are hosted on a Web server and are accessed by using client applications, such as a Web browser. A Website usually refers to the front-end interface through which the users interacts with a business online. A website consists of: HTML and other graphic files Audio and Video files Other static files Describing a Website and Web Application
4.
© People Strategists
www.peoplestrategists.com Slide 4 of 48 A Web application: Is a program that is stored on a remote server and delivered over the Internet through a Web browser using various protocols, such as HTTP. Is a Website with dynamic functionality on the server and can be controlled by the users. To access a Web application: A client sends a request to the Web server. A Web server processes the request, generates the response, and sends the response to the client. Describing a Website and Web Application (Contd.)
5.
© People Strategists
www.peoplestrategists.com Slide 5 of 48 What is an enterprise application? Identifying an Enterprise Application
6.
© People Strategists
www.peoplestrategists.com Slide 6 of 48 An enterprise application is the term used to describe applications or software that a business would use to assist the organization in solving enterprise problems. An enterprise application is an application that is: Large in size Distributed Secure and scalable Highly available Accessible through multiple types of clients Important aspects of an enterprise application are: Presentation logic Business logic Data Access logic System Services Identifying an Enterprise Application (Contd.)
7.
© People Strategists
www.peoplestrategists.com Slide 7 of 48 Java Enterprise Edition: Is Oracle's enterprise Java computing platform. Is built upon the foundation of Java Platform, Standard Edition (Java SE). Is an open and standard based platform for developing, deploying, and managing n-tier, Web-enabled, server-centric, and component-based enterprise applications. It consists of a set of services, APIs, and protocols that provide the functionality for developing multitier, Web-based applications. Is a collection of related technology specifications that describe required APIs and policies. Identifying Java Enterprise Edition (EE)
8.
© People Strategists
www.peoplestrategists.com Slide 8 of 48 Identifying the Features of Java EE Java EE comprises the following features: Client tier support: J2EE supports pure HTML, as well as Java applets or applications. It relies on Java Server Pages and servlet code to create HTML or other formatted data for the client. Middle Layer support: J2EE supports Enterprise JavaBeans (EJBs) as middle layer, where the platform's logic is stored. Java Database Connectivity (JDBC): J2EE supports JDBC, which is the Java equivalent to ODBC. JavaMail API: It consists of libraries to create, send, receive, and read email messages. It enables the J2EE applications to handle mail messages easily. It supports the IMAP4, POP3, and SMTP mail protocols.
9.
© People Strategists
www.peoplestrategists.com Slide 9 of 48 Identifying the Features of Java EE (Contd.) Java Naming and Directory Interface (JNDI) API: It enables application components and clients to search and link distributed resources, services, and EJB components. It allows the configuration of external and custom resources in the Sun ONE Application Server. Java Message Service (JMS) API: It enables the J2EE applications to create, send, receive, and read messages in a distributed environment. It uses JMS queues, topics, and message destinations, which are made available using the JNDI API.
10.
© People Strategists
www.peoplestrategists.com Slide 10 of 48 Identifying Various Types of Java EE Container Various types of Java EE containers are: Web container: Provides a runtime environment to manage deployed Web components, such as servlets and JSP. Applet container: Provides the runtime environment for executing applets. EJB container: Provides a runtime environment to manage deployed EJB components. Application client container: Provides a runtime environment for Java EE application clients. The following figure depicts the interaction between different Java EE containers. Application client container Applet container Web container EJB container Database
11.
© People Strategists
www.peoplestrategists.com Slide 11 of 48 Identifying JAR, WAR, and EAR In J2EE application, modules are packaged as Java archive (JAR), Web archive (WAR), and Enterprise archive (EAR) based on their functionality. JAR: Is a package file format that is used to group Java class files and associated metadata and resources into one file. Is used to distribute application software or libraries on the Java platform. WAR: Is used to package a Web application, which is a group of JSP, HTML, servlets, resources and source files. Includes a Web deployment descriptor file and can be used to import a Web application into a Web server. EAR: Is used by Java EE for packaging one or more modules into a single archive. Is used to enable the deployment of the various modules onto an application simultaneously and coherently.
12.
© People Strategists
www.peoplestrategists.com Slide 12 of 48 Identifying Various Java EE APIs and Technologies Java EE comprises of the following APIs and technologies: Standard Edition (Java SE) Java Servlets Java Server Pages™ (JSP™) Java Server Faces™ (JSF™) Remote Method Invocation (RMI) Java Persistence API (JPA) Java Message Service (JMS) API Java Naming and Directory Interface™ (JNDI) API Java Transaction API (JTA) Enterprise JavaBeans™ (EJB™) components Java API for XML Web Services (JAX-WS)
13.
© People Strategists
www.peoplestrategists.com Slide 13 of 48 Identifying Java Servlet A Servlet is a Java program that runs on a server and used to generate dynamic Web pages. Servlets performs the following tasks: Processes HTTP requests Generates dynamic HTTP responses Servlets act as a middle layer between a request coming from a Web browser or other HTTP client and databases. Servlets executes inside a Web container as a thread. The following figure depicts the position of the servlet in a Web application. HTTP Server Web Browser Servlet Program Database HTTP Protocol
14.
© People Strategists
www.peoplestrategists.com Slide 14 of 48 Identifying the Advantages of Java Servlet Some of the advantages of Java servlets are: Servlets are faster than CGI programs because each scripts in CGI produces a new process and these processes takes a lot of time for execution. However, servlets creates only new thread. Servlets are server side components that inherits the security provided by the Web server and Java Security Manager. Servlets provide all the powerful features of Java, such as exception handling and garbage collection. Servlets are portable across operating systems and across Web servers as servlets are write once, run anywhere (WORA) programs written in Java. Servlets can share data among each other and can maintain the session which helps them to maintain information from request to request. The servlet API is designed in such a way that it can be easily extensible.
15.
© People Strategists
www.peoplestrategists.com Slide 15 of 48 Identifying the Limitation of Java Servlet Some of the limitations of Java servlets are: Whenever a Web page changes, the servlet needs to be rewritten, recompiled, and redeployed. Servlets must handle concurrency issues. Tedious uses of out.println()statements. Designing in servlet is difficult and slows down the application. Writing complex business logic makes the application difficult to understand.
16.
© People Strategists
www.peoplestrategists.com Slide 16 of 48 Identify Servlet Terminology Basic terminologies used in servlet are: Hypertext Transfer Protocol (HTTP) HTTP request HTTP response Difference between Web server and application server Web container
17.
© People Strategists
www.peoplestrategists.com Slide 17 of 48 Identifying HTTP Protocol HTTP is a protocol that is used by a client and a server to communicate with each other. It supports only one request per connection. It can be used to transmit any file that follows the Multipurpose Internet Mail Extensions (MIME) specification. It uses the request and response process to transfer information from one computer to another
18.
© People Strategists
www.peoplestrategists.com Slide 18 of 48 Identifying HTTP Request HTTP request is like an envelope, which contains the necessary information required by the Web server to process a client request. An HTTP request consists of: Request line: It contains request method, request URL, and version. Request header: It contains additional information about the client, such as the name and the version of the Web browser. Message body: It is an optional part of the HTTP request. It contains the data entered by a user that needs processed. The following figure describes an HTTP request.
19.
© People Strategists
www.peoplestrategists.com Slide 19 of 48 Identifying HTTP Response HTTP response is like an envelope that contains the response generated by a server that would be displayed by a Web browser. The HTTP response consists of: Status line: It consists of status code, reason phrase, and version of the HTTP protocol. Response header: It contains additional information about the Web server. Message body: It consists of the response in the form of Hyper Text Markup Language (HTML) format. The following figure describes an HTTP response.
20.
© People Strategists
www.peoplestrategists.com Slide 20 of 48 Difference Between the Web Server and Application Server Web Server Application Server Web server handles the HTTP protocol. Whenever, a Web server receives an HTTP request, it responds with an HTTP response. It may respond with a static HTML page or image, send or redirect, or delegate the dynamic response generation to some other program such as CGI scripts, JSPs (Java Server Pages), Servlets. An application server exposes business logic to client applications through various protocols like HTTP, TCP-IP etc. An application server providers allows the client to access the business logic for use. An application server is used to run business logic or dynamically generating presentation code. An application server is more capable of dynamic behavior than web server. The following points depicts the differences between the Web server and Application server:
21.
© People Strategists
www.peoplestrategists.com Slide 21 of 48 Identifying Web Container What is a Web container?
22.
© People Strategists
www.peoplestrategists.com Slide 22 of 48 Identifying Web Container (Contd.) Web container is a Java virtual machine that supplies an implementation of the Java Servlet API. All Java servlets must exist in the Web container. Web Container activate the servlet that match to request.
23.
© People Strategists
www.peoplestrategists.com Slide 23 of 48 The following figure depicts how the Web container handles the client request. Web server Client Web container Servlet Thread Service() doGet() <html> <body> ----------- </body> </html> Identifying Web Container (Contd.)
24.
© People Strategists
www.peoplestrategists.com Slide 24 of 48 Execution Process of Java Servlets Following steps illustrates how a Java servlet executes: 1. The client sends request to the server. 2. The Web container, running inside the server, receives the request. 3. The Web container creates a new thread to process the request. 4. The Web container forwards the request to the servlet. 5. The Web container executes the servlet.
25.
© People Strategists
www.peoplestrategists.com Slide 25 of 48 Execution Process of Java Servlets (Contd.) The following figure depicts the execution process of a servlet with a single request.
26.
© People Strategists
www.peoplestrategists.com Slide 26 of 48 Execution Process of Java Servlets (Contd.) The following figure depicts the execution process of a servlet with multiple requests. Processor’s load does not increase much on execution of multiple requests.
27.
© People Strategists
www.peoplestrategists.com Slide 27 of 48 Exploring Servlet API (Contd.) Servlet API: is used to create and manage servlets. consists of various interfaces, classes, and methods. classes and methods are available in the following packages: javax.servlet javax.servlet.http
28.
© People Strategists
www.peoplestrategists.com Slide 28 of 48 Exploring Servlet API (Contd.) The following figure depicts the class hierarchy of the Servlet API. Servlet API ServletException Javax.servlet.http Servlet ServletConfig ServletContext ServletRequest ServletResponse AsyncContext Javax.servlet GenericServlet Cookie HttpServletRequest HttpServletResponse HttpSession HttpServlet Packages Classes Interfaces RequestDispatcher
29.
© People Strategists
www.peoplestrategists.com Slide 29 of 48 The javax.servlet package: consists of the following interfaces, as described in the table. Interface Description Servlet It provides the methods that all servlets must implement. ServletConfig It provides information to the servlets during the servlet initialization. ServletContext It provides methods, which is used by the servlets to communicate with the Web container. ServletRequest It provides the client request information to the servlet. ServletResponse It helps the servlet in sending the response to the client. RequestDispatcher It receives a request from a client and sends it to any other resource, such as a servlet, an HTML page, or a JSP page. AsyncContext It provides the methods to handle multiple client requests asynchronously. Exploring Servlet API (Contd.)
30.
© People Strategists
www.peoplestrategists.com Slide 30 of 48 The Servlet interface methods are implemented by the servlet class that extends from a GenericServlet or HttpServlet class. The following table describes the various methods defined in the Servlet interface: Exploring Servlet API (Contd.) Method Description void init(ServletConfig config) throws ServletException It is called by the servlet container to indicate to a servlet that the servlet is being placed into service. ServletConfig getServletConfig() Returns a ServletConfig object, which contains initialization and startup parameters for this servlet. String getServletInfo() Returns information about the servlet, such as author, version, and copyright. void service(ServletRequest request, ServletResponse response) throws ServletException, IOException It is Called by the servlet container to allow the servlet to respond to a request. void destroy() Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.
31.
© People Strategists
www.peoplestrategists.com Slide 31 of 48 The following table describes the various methods defined in the ServletRequest interface: Exploring Servlet API (Contd.) Method Description public String getParameter(String paramName) Returns a String object that specifies the value of a particular request parameter. public String[] getParameterValues(String paramName) Returns an array of String objects that contains all the values of the request parameter. public Enumeration getParameterNames() Returns an Enumeration object containing all the parameter names as String objects that `request contains. public String getRemoteHost() Returns a String object that specifies the full-qualified name of the computer from which the request is sent. public String getRemoteAddr() Returns a String object that specifies the IP address of the computer from which the request is sent.
32.
© People Strategists
www.peoplestrategists.com Slide 32 of 48 The following table describes the various methods defined in the ServletResponse interface: Exploring Servlet API (Contd.) Method Description public ServletOutputStream getOutputStream() throws IOException Returns an object of the ServletOutputStream class that represents an output stream to send binary data as response. public PrintWriter getWriter() throws IOException Returns an object of the PrintWriter class that the servlet uses to send character data as response. public void setContentType(String type) Sets the MIME type for a servlet response. Some of the MIME types are text/plain, image/jpeg, and text/html.
33.
© People Strategists
www.peoplestrategists.com Slide 33 of 48 The javax.servlet package: Consists of the following classes: GenericServlet ServletException The GenericServlet class defines a generic, protocol-independent servlet. The GenericServlet implements the Servlet and ServletConfig interfaces . The ServletException class defines a general exception a servlet can throw when it encounters difficulty. The ServletException class contains the following constructors: ServletException() ServletException(String message) ServletException(String message, Throwable rootCause) Exploring Servlet API (Contd.)
34.
© People Strategists
www.peoplestrategists.com Slide 34 of 48 The following code illustrates a simple example of servlet by inheriting the GenericServlet class: Exploring Servlet API (Contd.) import java.io.*; import javax.servlet.*; public class myFirstServlet extends GenericServlet{ public void service(ServletRequest req, ServletResponse res)throws IOException, ServletException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); out.print("<html><body>"); out.print("<b>hello generic servlet</b>"); out.print("</body></html>"); } }
35.
© People Strategists
www.peoplestrategists.com Slide 35 of 48 Exploring Servlet API (Contd.) The javax.servlet.http package: Provides classes and interfaces that enable you to create a servlet that communicates using the HTTP protocol. Provides the HttpServlet class to create servlets, which is an abstract class. Provides the HttpServlet class that extends the GenericServlet class and implements Serializable interface. Provides HTTP specific methods, such as doGet, doPost, and doHead. Some of the interfaces of the javax.servlet.http package are:` HttpServletRequest HttpServletResponse HttpSession
36.
© People Strategists
www.peoplestrategists.com Slide 36 of 48 The following table describes the various methods defined in the HttpServletRequest interface: Exploring Servlet API (Contd.) Method Description public String getHeader(String fieldname) Returns the value of the request header field, such as Cache-Control and Accept-Language, specified in the parameter. public Enumeration getHeaders(String sname) Returns all the values associated with a specific request header as an enumeration of String objects. public Enumeration getHeaderNames() Returns the names of all the request headers that a servlet can access as an enumeration of String objects.
37.
© People Strategists
www.peoplestrategists.com Slide 37 of 48 The following table describes the various methods defined in the HttpServletResponse interface: Exploring Servlet API (Contd.) Method Description void setHeader(String hname, String hvalue) Sets the value of header hname to hvalue. If the header has already been set, the new value overwrites the existing value. void setIntHeader(String hname, int hvalue) Sets the value of the header hname to the int value, hvalue. If the header has already been set, the new value overwrites the existing value. void addHeader(String hname, String hvalue) Adds a header hname with value hvalue. This method adds a new header if the header already exists. void addIntHeader(String hname, int hvalue) Adds a header hname with an int value, hvalue. boolean containsHeader(String hname) Returns true if the header hname has already been set with a specific value and false, if not. void sendRedirect(String url) Redirects a request to the specified URL.
38.
© People Strategists
www.peoplestrategists.com Slide 38 of 48 The following table describes the various methods defined in the HttpSession interface: Exploring Servlet API (Contd.) Method Description public void setAttribute(String name, Object value) Binds the object with a name and stores the name/value pair as an attribute of the HttpSession object. If an attribute already exists, this method replaces the existing attribute. public Object getAttribute(String name) Retrieves the String object specified in the parameter, from the session object. If no object is found for the specified attribute, the getAttribute()method returns null. public Enumeration getAttributeNames() Returns an Enumeration object that contains the name of all the objects that are bound as attributes to the session object.
39.
© People Strategists
www.peoplestrategists.com Slide 39 of 48 The following code illustrates a simple example of servlet by inheriting the HttpServlet class: Exploring Servlet API (Contd.) import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class myFirstHttpServlet extends HttpServlet { public void doGe(HttpServletRequest request, HttpServletResponse response)throws IOException{ PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<body>"); out.println("<h1>Hello Servlet Get</h1>"); out.println("</body>"); out.println("</html>"); } }
40.
© People Strategists
www.peoplestrategists.com Slide 40 of 48 Identifying Servlet Life Cycle Process the request- service() Loading servlet, Instantiate and Initialization - init() Unload servlets / Take out of service - destroy() doGet() or doPost() Calls Calls Calls The Web container maintains the life cycle of a servlet instance. The following figure depicts the life cycle of Java servlet. 1. Servlet class is loaded. 2. Servlet instance is created. 3. init()method is invoked. 4. service()method is invoked. 5. destroy()method is invoked.
41.
© People Strategists
www.peoplestrategists.com Slide 41 of 48 Implementing a Servlet To create a servlet, you need to perform the following tasks: Create a servlet. Configure the servlet. Compile and deploy the servlet. Access the servlet using a browser application.
42.
© People Strategists
www.peoplestrategists.com Slide 42 of 48 Creating a Servlet Servlet can be created by extending the HttpServlet or GenericServlet class. Example: Consider a scenario in which you have to create servlet that displays the current date to the user, each time the servlet is accessed. To do this, you have to create a servlet that extends from the HttpServlet class, as shown in the embedded file.
43.
© People Strategists
www.peoplestrategists.com Slide 43 of 48 Configuring a Servlet Configuring a servlet means, associating a URL with the servlet. Servlets can be configured using either of the way: Deployment descriptor (DD) Annotations A deployment descriptor is an XML file with the name web.xml that contains configuration information of a Web application. Each Web application contains one web.xml file. The elements of the web.xml file enable you to specify: Servlet context initialization parameters of a Web application. Initialization parameter for the servlet. Mapping between a file extension and a MIME type. Mapping between a servlet and a URL pattern. The name of the listener class that responds to a servlet life cycle event.
44.
© People Strategists
www.peoplestrategists.com Slide 44 of 48 Configuring a Servlet (Contd.) Some of the commonly used elements of the web.xml file along with their usage are: <servlet>: specifies the configuration details of all the servlets used in a Web application and contains the following sub elements: <servlet-name> <servlet-class> <servlet-mapping>: consists of following sub elements: <servlet-name> <url-pattern> <session-config> <init-param> <mime-mapping> Sample DD file:
45.
© People Strategists
www.peoplestrategists.com Slide 45 of 48 Configuring a Servlet (Contd.) Configuring a servlet by using annotations: The javax.servlet.annotation package defines the @WebServer annotation that you can use to configure a servlet, as shown in the following sample code snippet: @WebServer(name="MyFirstServlet", urlPatterns={"/MyFirstServlet", "/MyServlet/*"}) public class MyFirstServlet extends HttpServlet { … } The @WebServer annotation is used to configure the MyFirstServlet servlet. The name attribute specifies the name of the servlet. The urlPatterns attribute is used to map the servlet with the URL patterns.
46.
© People Strategists
www.peoplestrategists.com Slide 46 of 48 Compile and Deploy the Servlet on Server To You can compile and deploy your application using your Eclipse IDE. Finally, you can access the Web application using the URL, as shown the following code snippet: Http://Localhost:8080/myApplication/
47.
© People Strategists
www.peoplestrategists.com Slide 47 of 48 Summary A Web page is an electronic document, which is created using HTML and is translated by the Web browser. A website is a collection of one or more Web pages, which are hosted on a Web server and are accessed by using client applications, such as a Web browser. A Web application is a program that is stored on a remote server and delivered over the Internet through a Web browser using various protocols, such as HTTP. An enterprise application is the term used to describe applications or software that a business would use to assist the organization in solving enterprise problems. Java EE is built upon the foundation of Java Platform, Standard Edition (Java SE). Web container provides a runtime environment to manage deployed Web components, such as servlets and JSP.
48.
© People Strategists
www.peoplestrategists.com Slide 48 of 48 Summary (Contd.) Applet container provides the runtime environment for executing applets. EJB container provides a runtime environment to manage deployed EJB components. Application client container provides a runtime environment for Java EE application clients. Java Servlet API consists of two packages: javax.servlet package javax.servlet.http package The various interfaces of javax.servlet package are: ServletRequest interface ServletContext interface ServletResponse interface
49.
© People Strategists
www.peoplestrategists.com Slide 49 of 48 Summary (Contd.) Servlet interface provides the methods that all servlets must implement. The GenericServlet class defines a generic, protocol-independent servlet. The GenericServlet implements the Servlet and ServletConfig interfaces . The ServletException class defines a general exception a servlet can throw when it encounters difficulty. The HttpServlet class is used to create a servlets that communicates using the HTTP protocol. The HttpServlet class that extends the GenericServlet class and implements Serializable interface.
Jetzt herunterladen