SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados (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)
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

servlets and jsp