SlideShare a Scribd company logo
1 of 27
Java server pages
DEFINITION FOR JSP
Java Server Pages (JSP) is a technology
for developing web pages that support dynamic
content which helps developers insert java code
in HTML pages by making use of special JSP tags,
most of which start with <% and end with %>.
EXAMPLE
We can collect input from users through
web page forms
In the early days of the Web, the Common
Gateway Interface (CGI) was the only tool for
developing dynamic web content. However, CGI is
not an efficient solution.
For every request that comes in, the web
server has to create a new operating-system
process, load aninterpreter and a script, execute
the script, and then tear it all down again.
This is very taxing for the server and doesn't
scale well when the amount of traffic increases.
 Active Server Pages (ASP)
 PHP
 ColdFusion
 Server-Side Includes (SSI)
 JavaScript
 Pure Servlet
 Static HTML
The advantages of JSP are twofold.
First, the dynamic part is written in Java,
not Visual Basic or other MS specific
language, so it is more powerful and easier
to use. Second, it is portable to other
operating systems and non-Microsoft Web
servers.
PHP1 is an open source web scripting language.
Like JSP and ASP, PHP allows a page author to
include scripting code in regular web pages to
generate dynamic content.
PHP has a C-like syntax with some features
borrowed from Perl, C++, and Java.
The current version, compiles a page when it's
requested, executes it and merges the result of
executing the scripts with the static text in the
page, before it's returned to the browser.
The dynamic parts of a page are generated by
inserting HTML/XML -like elements, known as the
ColdFusion Markup Language (CFML), into web pages.
The latest version of ColdFusion also includes
elements for communication with Java servlet and
Enterprise JavaBeans.
Custom elements can be developed in C++ or Java to
encapsulate application specific functions, and CFML
extensions are available from third parties.
Server Side Iincludes is really
only intended for simple inclusions,
not for "real" programs that use form
data, make database connections,
and the like.
JavaScript can generate
HTML dynamically on the client but
can hardly interact with the web
server to perform complex tasks like
database access and image
processing etc.
It is more convenient to write
(and to modify!) regular HTML than
to have plenty of println statements
that generate the HTML.
Regular HTML, of course, cannot
contain dynamic information.
A JSP life cycle can be defined as
the entire process from its creation
till the destruction which is similar
to a servlet life cycle with an
additional step which is required to
compile a JSP into servlet.
Compilation
Initialization
Execution
Cleanup
When a browser asks for a JSP, the JSP
engine first checks and the JSP engine compiles
the page. If the page has never been compiled
and JSP has been modified.
The compilation process involves three steps:
 Parsing the JSP.
 Turning the JSP into a servlet.
 Compiling the servlet.
When a container loads a JSP it invokes the
jspInit() method before servicing any requests. If
you need to perform JSP-specific initialization,
override the jspInit() method.
Example:
public void jspInit()
{ // Initialization code...
}
Typically initialization is performed only
once and as with the servlet init method
This phase of the JSP life cycle represents all
interactions with requests until the JSP is destroyed.
Whenever a browser requests a JSP and the page
has been loaded and initialized, the JSP engine
invokes the _jspService() method in the JSP.
The _jspService() method takes an
HttpServletRequest and an HttpServletResponse as
its parameters as follows
Example
void _jspService (HttpServletRequest request,
HttpServletResponse response)
{
// Service handling code...
}
The destruction phase of the JSP life cycle
represents when a JSP is being removed from use
by a container.
The jspDestroy() method is the JSP
equivalent of the destroy method for servlets.
Example
public void jspDestroy()
{
// Your cleanup code goes here.
}
SCRIPLET
A scriptlet can contain any number of
JAVA language statements, variable or
method declarations, or expressions that are
valid in the page scripting language.
Syntax of Scriptlet
<% code fragment %>
<html>
<head><title>Hello World</title></head>
<body>
Hello World!<br/>
<%
out.println("Your IP address is " +
request.getRemoteAddr());
%>
</body>
</html>
A declaration declares one or more
variables or methods that you can use in Java
code later in the JSP file.
Syntax of JSP DECLARATIONS
<%! declaration; %>
Example
<%! int a, b, c=0; %>
<%! Circle a = new Circle(2.0); %>
<%! int day = 3; %>
<html>
<head><title>SWITCH...CASE Example</title></head>
<body>
<%
switch(day) {
case 0:
out.println("It's Sunday.");
break;
case 1:
out.println("It's Monday.");
break;
case 2:
out.println("It's Tuesday.");
break;
case 3:
out.println("It's Wednesday.");
break;
case 4:
out.println("It's Thursday.");
break;
case 5:
out.println("It's Friday.");
break;
default:
out.println("It's Saturday.");
}
%>
</body>
</html>
This would produce following result:
It's Wednesday.
Jsp

More Related Content

What's hot

Single Page Applications on JavaScript and ASP.NET MVC4
Single Page Applications on JavaScript and ASP.NET MVC4Single Page Applications on JavaScript and ASP.NET MVC4
Single Page Applications on JavaScript and ASP.NET MVC4Yuriy Shapovalov
 
Java script Basic
Java script BasicJava script Basic
Java script BasicJaya Kumari
 
Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSM R Rony
 
Jsp viva questions
Jsp viva questionsJsp viva questions
Jsp viva questionsVipul Naik
 
Skill practical javascript diy projects
Skill practical javascript diy projectsSkill practical javascript diy projects
Skill practical javascript diy projectsSkillPracticalEdTech
 
Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012daniel plocker
 
Depurando VBScript no InduSoft Web Studio
Depurando VBScript no InduSoft Web StudioDepurando VBScript no InduSoft Web Studio
Depurando VBScript no InduSoft Web StudioAVEVA
 
Native web architcture
Native web architctureNative web architcture
Native web architctureRohit
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page ApplicationCodemotion
 
Java script202
Java script202Java script202
Java script202Wasiq Zia
 
Java Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web developmentJava Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web developmentNicheTech Com. Solutions Pvt. Ltd.
 
Unobtrusive js
Unobtrusive jsUnobtrusive js
Unobtrusive jsbretticus
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Spike Brehm
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREnearlearn
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREnearlearn
 
single page application
single page applicationsingle page application
single page applicationRavindra K
 

What's hot (20)

Single Page Applications on JavaScript and ASP.NET MVC4
Single Page Applications on JavaScript and ASP.NET MVC4Single Page Applications on JavaScript and ASP.NET MVC4
Single Page Applications on JavaScript and ASP.NET MVC4
 
Java script Basic
Java script BasicJava script Basic
Java script Basic
 
Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJS
 
EJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 PreludeEJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 Prelude
 
Jsp viva questions
Jsp viva questionsJsp viva questions
Jsp viva questions
 
Skill practical javascript diy projects
Skill practical javascript diy projectsSkill practical javascript diy projects
Skill practical javascript diy projects
 
Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012
 
Visual resume
Visual resumeVisual resume
Visual resume
 
Depurando VBScript no InduSoft Web Studio
Depurando VBScript no InduSoft Web StudioDepurando VBScript no InduSoft Web Studio
Depurando VBScript no InduSoft Web Studio
 
Native web architcture
Native web architctureNative web architcture
Native web architcture
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page Application
 
Java script202
Java script202Java script202
Java script202
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
Java Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web developmentJava Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web development
 
Unobtrusive js
Unobtrusive jsUnobtrusive js
Unobtrusive js
 
Javascript
JavascriptJavascript
Javascript
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALORE
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALORE
 
single page application
single page applicationsingle page application
single page application
 

Similar to Jsp

The Java Server Page in Java Concept.pptx
The Java Server Page in Java Concept.pptxThe Java Server Page in Java Concept.pptx
The Java Server Page in Java Concept.pptxKavitha713564
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGESKalpana T
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)Manisha Keim
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practicesejjavies
 
Csajsp Chapter10
Csajsp Chapter10Csajsp Chapter10
Csajsp Chapter10Adil Jafri
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsKaml Sah
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and ServletsRaghu nath
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESYoga Raja
 
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
 
Online grocery store
Online grocery storeOnline grocery store
Online grocery storeKavita Sharma
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jspsandeep54552
 
Java Servlet
Java ServletJava Servlet
Java ServletYoga Raja
 
Arpita industrial trainingppt
Arpita industrial trainingpptArpita industrial trainingppt
Arpita industrial trainingpptARPITA SRIVASTAVA
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet backdoor
 

Similar to Jsp (20)

The Java Server Page in Java Concept.pptx
The Java Server Page in Java Concept.pptxThe Java Server Page in Java Concept.pptx
The Java Server Page in Java Concept.pptx
 
Unit 4 web technology uptu
Unit 4 web technology uptuUnit 4 web technology uptu
Unit 4 web technology uptu
 
Unit 4 1 web technology uptu
Unit 4 1 web technology uptuUnit 4 1 web technology uptu
Unit 4 1 web technology uptu
 
Java server pages
Java server pagesJava server pages
Java server pages
 
JSP overview
JSP overviewJSP overview
JSP overview
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practices
 
Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
Jsp in Servlet by Rj
 
Jsp tutorial
Jsp tutorialJsp tutorial
Jsp tutorial
 
Csajsp Chapter10
Csajsp Chapter10Csajsp Chapter10
Csajsp Chapter10
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and Servlets
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
 
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...
 
Online grocery store
Online grocery storeOnline grocery store
Online grocery store
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
 
Java Servlet
Java ServletJava Servlet
Java Servlet
 
Arpita industrial trainingppt
Arpita industrial trainingpptArpita industrial trainingppt
Arpita industrial trainingppt
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
 

More from SindhuVelmukull

More from SindhuVelmukull (12)

Web input forms.pptx
Web input forms.pptxWeb input forms.pptx
Web input forms.pptx
 
Web protocol.pptx
Web protocol.pptxWeb protocol.pptx
Web protocol.pptx
 
Web technology.pptx
Web technology.pptxWeb technology.pptx
Web technology.pptx
 
YIQ by R.Chinthamani.pptx
YIQ by R.Chinthamani.pptxYIQ by R.Chinthamani.pptx
YIQ by R.Chinthamani.pptx
 
PROPERTIES OF LIGHT by R.Chinthamani.pptx
PROPERTIES OF LIGHT by R.Chinthamani.pptxPROPERTIES OF LIGHT by R.Chinthamani.pptx
PROPERTIES OF LIGHT by R.Chinthamani.pptx
 
Overview of CG by R.Chinthamani.pptx
Overview of CG by R.Chinthamani.pptxOverview of CG by R.Chinthamani.pptx
Overview of CG by R.Chinthamani.pptx
 
Bundled Attributes by R.Chinthamani.pptx
Bundled Attributes by R.Chinthamani.pptxBundled Attributes by R.Chinthamani.pptx
Bundled Attributes by R.Chinthamani.pptx
 
RGB Color.pptx
RGB Color.pptxRGB Color.pptx
RGB Color.pptx
 
Projection.pptx
Projection.pptxProjection.pptx
Projection.pptx
 
c++
 c++  c++
c++
 
Introduction to artificial intelligence
Introduction to artificial intelligenceIntroduction to artificial intelligence
Introduction to artificial intelligence
 
COMPUTER NETWORK
COMPUTER NETWORKCOMPUTER NETWORK
COMPUTER NETWORK
 

Recently uploaded

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 

Recently uploaded (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

Jsp

  • 2. DEFINITION FOR JSP Java Server Pages (JSP) is a technology for developing web pages that support dynamic content which helps developers insert java code in HTML pages by making use of special JSP tags, most of which start with <% and end with %>. EXAMPLE We can collect input from users through web page forms
  • 3. In the early days of the Web, the Common Gateway Interface (CGI) was the only tool for developing dynamic web content. However, CGI is not an efficient solution. For every request that comes in, the web server has to create a new operating-system process, load aninterpreter and a script, execute the script, and then tear it all down again. This is very taxing for the server and doesn't scale well when the amount of traffic increases.
  • 4.  Active Server Pages (ASP)  PHP  ColdFusion  Server-Side Includes (SSI)  JavaScript  Pure Servlet  Static HTML
  • 5. The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.
  • 6. PHP1 is an open source web scripting language. Like JSP and ASP, PHP allows a page author to include scripting code in regular web pages to generate dynamic content. PHP has a C-like syntax with some features borrowed from Perl, C++, and Java. The current version, compiles a page when it's requested, executes it and merges the result of executing the scripts with the static text in the page, before it's returned to the browser.
  • 7. The dynamic parts of a page are generated by inserting HTML/XML -like elements, known as the ColdFusion Markup Language (CFML), into web pages. The latest version of ColdFusion also includes elements for communication with Java servlet and Enterprise JavaBeans. Custom elements can be developed in C++ or Java to encapsulate application specific functions, and CFML extensions are available from third parties.
  • 8. Server Side Iincludes is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like.
  • 9. JavaScript can generate HTML dynamically on the client but can hardly interact with the web server to perform complex tasks like database access and image processing etc.
  • 10. It is more convenient to write (and to modify!) regular HTML than to have plenty of println statements that generate the HTML.
  • 11. Regular HTML, of course, cannot contain dynamic information.
  • 12. A JSP life cycle can be defined as the entire process from its creation till the destruction which is similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet.
  • 14.
  • 15. When a browser asks for a JSP, the JSP engine first checks and the JSP engine compiles the page. If the page has never been compiled and JSP has been modified. The compilation process involves three steps:  Parsing the JSP.  Turning the JSP into a servlet.  Compiling the servlet.
  • 16. When a container loads a JSP it invokes the jspInit() method before servicing any requests. If you need to perform JSP-specific initialization, override the jspInit() method. Example: public void jspInit() { // Initialization code... } Typically initialization is performed only once and as with the servlet init method
  • 17. This phase of the JSP life cycle represents all interactions with requests until the JSP is destroyed. Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService() method in the JSP. The _jspService() method takes an HttpServletRequest and an HttpServletResponse as its parameters as follows
  • 18. Example void _jspService (HttpServletRequest request, HttpServletResponse response) { // Service handling code... }
  • 19. The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a container. The jspDestroy() method is the JSP equivalent of the destroy method for servlets. Example public void jspDestroy() { // Your cleanup code goes here. }
  • 20. SCRIPLET A scriptlet can contain any number of JAVA language statements, variable or method declarations, or expressions that are valid in the page scripting language. Syntax of Scriptlet <% code fragment %>
  • 21. <html> <head><title>Hello World</title></head> <body> Hello World!<br/> <% out.println("Your IP address is " + request.getRemoteAddr()); %> </body> </html>
  • 22.
  • 23. A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. Syntax of JSP DECLARATIONS <%! declaration; %> Example <%! int a, b, c=0; %> <%! Circle a = new Circle(2.0); %>
  • 24. <%! int day = 3; %> <html> <head><title>SWITCH...CASE Example</title></head> <body> <% switch(day) { case 0: out.println("It's Sunday."); break; case 1: out.println("It's Monday."); break; case 2: out.println("It's Tuesday."); break;
  • 25. case 3: out.println("It's Wednesday."); break; case 4: out.println("It's Thursday."); break; case 5: out.println("It's Friday."); break; default: out.println("It's Saturday."); } %> </body> </html>
  • 26. This would produce following result: It's Wednesday.