SlideShare une entreprise Scribd logo
1  sur  28
J2EE
Introduction
●

Q. What is J2EE ?
Java platform to developing enterprise web
application
Basic Architecture
Description
●

J2EE architecture : 3 tier
–

Client Tier ( Web tier)
●

–

Business Tier
●

–

The Presentation layer on the client side includes j2ee
componenets such as jsp,jsf etc
Components containing business logic of the
application such as Enterprise Beans.

Database Tier
●

This tier contains the persistence API of the application
so as to talk to database
Java Web Components
●

Servlet

●

Jsp ( Java Server Pages )

●

Jstl (Jsp Standard Tag Library)

●

Jsf ( Java Server Faces )
Servlet
●

Extends web server's functionality

●

Respond to Request from client

●

Used to generate dynamic response

●

Usually responses in HTML or Xml format

●

Most often used with HTTP protocol
Functioning of Servlet
●

●

●

Process or Store data that was submitted by
HTML forms
Provide dynamic content such as the result of
a database query
Manage State information
(in case of stateless HTTP protocol)
Packages (imports) for Servlet
●

java.io.*;
–

●

javax.servlet
–

●

Input and Output package (eg. Out.println)
Contains interaction logic between web container
and servlet

javax.servlet.http
–

Contains Http specific logic
●

javax.servlet.http.HttpServletRequest;

●

javax.servlet.http.HttpServletRespons
Servlet Skeleton
●

Imports

●

Public classname extends HttpServlet
–

Public void init()
●

–

Public void Service()
●

–

{ /* Initialization goes here */ }
{/* Business logic goes here */ }

Public void destroy()
●

{/* Free resources here */}
Lifecycle
●

Loaded and Instantiated

●

Initialization

●

Servicing the request

●

Destroying the request
●

Loaded and instantiated
–

●

Container loads servlet during startup or when the
request is made. After loading the servlet , the
container creates the instance of the servlet when
the first request come for service ,

Initialization
–

After creating the instance the container calls init()
method. The init method is called only once in
servlets lifetime. Initialization logic goes here
●

Servicing the request
–

After successful initialization , servlet will be
available to serve the request. Servlet creates
separate thread for each request

–

Service() method is called to serve the request
in short service method contains the business
logic
●

Destroying the servlet
–

If the servlet is no longer needed , the servlet
container calls the destroy() method.

–

Like the init() method destroy() method also get
called only once in servlet's lifetime

–

Destroy() method releases all the resources which
were acquired previously
JSP (Java Server Pages)
●

Jsp is a component which generates dynamic
contents

●

Jsp is a server-side technology

●

Extension : .jsp

●

Jsp usually consist of two components
–

Static Data
●

–

Can be expressed in any text based format such as
HTML

JSP elements
●

Jsp tags , which can generates dynamic contents
JSP Components
●

Declaration tag

●

Scriptlet tag

●

Expression tag

●

Directive tag

●

Action tag
●

Declaration tag:
–

Declaration is used to declare and define java
variables and methods inside your jsp

–

They are initialized when the jsp page is initialized

–

The scope of the declared variables or methods is
within the jsp page

–

Syntax : <%! int a = 10; %>
Declaration Example :
<html>
<body>
<%! int value = 10; %>
Hello World!<%= value %>
</body>
</html>
●

Scriptlet tag:
–

Scriptlets are block of java code

–

You can write any number of java code inside your
jsp using scriptlet

–

Syntax : <% ( Java Code ) %>
Scriptlet Example :
<html>
<body>
Hello World!
<%
out.println("Helloworld");
%>
</body>
</html>
●

Expression tag:
–

The code placed inside expression tag is printed
(output) , so there is no need to write out.println()

–

Mainly used to print values of variables and
methods

–

Syntax : <%= (variable or method) %>
Expression Example :
<html>
<body>
<%! int value = 10; %>
Hello World! <%= value %>
</body>
</html>
●

Directive tag:
–

Jsp directive provide directions and instructions to
the container , how to handle certain jsp
processing

–

There are 3 types of directives
●
●
●

Page directive
Include directive
Taglib directive
–

Page directive
●

●
●

Page directive is used to provide information about the
page
Example : <%@page language="java" %>
Here language is an attribute of the page directive
–

Include directive
●
●
●

Include is used to include a jsp file in the jsp page
Example : <%@ include file="/header.jsp" %>
File is an attribute which specifies which file need to
include
–

Taglib directive
●

●
●

Taglib directive is used to use the custom tags in the
jsp page ( custom tags allow us to define our own tags )
Example :
<%@ taglib uri="tlds/taglib.tld" prefix="mytag" %>
●

Action tag:
–

The action tag basically are used to control the
flow between pages and to use Java Beans
–

Some of the action tags are
●
●
●
●
●
●
●
●

Jsp:forward
Jsp:include
Jsp:useBean
Jsp:setProperty
Jsp:getPropery
Jsp:plugin
Jsp:param
Jsp:fallback

Contenu connexe

Tendances (20)

Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Jsp
JspJsp
Jsp
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Jsp
JspJsp
Jsp
 
XML parsing using jaxb
XML parsing using jaxbXML parsing using jaxb
XML parsing using jaxb
 
Jsp(java server pages)
Jsp(java server pages)Jsp(java server pages)
Jsp(java server pages)
 
Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Jsp tutorial (1)
Jsp tutorial (1)Jsp tutorial (1)
Jsp tutorial (1)
 
Jsp sasidhar
Jsp sasidharJsp sasidhar
Jsp sasidhar
 
JSP Scope variable And Data Sharing
JSP Scope variable And Data SharingJSP Scope variable And Data Sharing
JSP Scope variable And Data Sharing
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Struts2
Struts2Struts2
Struts2
 
Laravel Level 1 (The Basic)
Laravel Level 1 (The Basic)Laravel Level 1 (The Basic)
Laravel Level 1 (The Basic)
 
Laravel level 0 (introduction)
Laravel level 0 (introduction)Laravel level 0 (introduction)
Laravel level 0 (introduction)
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
 
Java server pages
Java server pagesJava server pages
Java server pages
 
Jsp
JspJsp
Jsp
 
Laravel level 2 (Let's Practical)
Laravel level 2 (Let's Practical)Laravel level 2 (Let's Practical)
Laravel level 2 (Let's Practical)
 

En vedette

Advance java natraj - satya
Advance java natraj -  satyaAdvance java natraj -  satya
Advance java natraj - satyaSatya Johnny
 
Java Abs Online Handwritten Script Recognition
Java Abs   Online Handwritten Script RecognitionJava Abs   Online Handwritten Script Recognition
Java Abs Online Handwritten Script Recognitionncct
 

En vedette (7)

Advance java natraj - satya
Advance java natraj -  satyaAdvance java natraj -  satya
Advance java natraj - satya
 
Php peers
Php peersPhp peers
Php peers
 
Java Abs Online Handwritten Script Recognition
Java Abs   Online Handwritten Script RecognitionJava Abs   Online Handwritten Script Recognition
Java Abs Online Handwritten Script Recognition
 
Xml naresh tech
Xml naresh techXml naresh tech
Xml naresh tech
 
Struts santhosh
Struts santhoshStruts santhosh
Struts santhosh
 
Java servlet
Java servletJava servlet
Java servlet
 
Java notes
Java notesJava notes
Java notes
 

Similaire à servlets and jsp

Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2Long Nguyen
 
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
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptxMattMarino13
 
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
 
Servlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp objectServlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp objectADITYADIXIT974283
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server PageVipin Yadav
 
Core web application development
Core web application developmentCore web application development
Core web application developmentBahaa Farouk
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsKaml Sah
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overviewskill-guru
 
presentation on online movie ticket booking
presentation on online movie ticket bookingpresentation on online movie ticket booking
presentation on online movie ticket bookingdharmawath
 

Similaire à servlets and jsp (20)

Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
20jsp
20jsp20jsp
20jsp
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
JSP Part 1
JSP Part 1JSP Part 1
JSP Part 1
 
JSP Directives
JSP DirectivesJSP Directives
JSP Directives
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
 
Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
Jsp in Servlet by Rj
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptx
 
Jsp
JspJsp
Jsp
 
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
 
Servlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp objectServlet., tomcat server, implicit jsp object
Servlet., tomcat server, implicit jsp object
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
 
JSP.pptx
JSP.pptxJSP.pptx
JSP.pptx
 
Core web application development
Core web application developmentCore web application development
Core web application development
 
Jsp basic
Jsp basicJsp basic
Jsp basic
 
Wt unit 4
Wt unit 4Wt unit 4
Wt unit 4
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
 
presentation on online movie ticket booking
presentation on online movie ticket bookingpresentation on online movie ticket booking
presentation on online movie ticket booking
 

Dernier

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Dernier (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

servlets and jsp