SlideShare a Scribd company logo
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

Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassSpike Brehm
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js Platform
Naresh Chintalcheru
 
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
In Pursuit of the Holy Grail: Building Isomorphic JavaScript AppsIn Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
In Pursuit of the Holy Grail: Building Isomorphic JavaScript AppsSpike Brehm
 
Introduction To JavaScript Ajax
Introduction To JavaScript AjaxIntroduction To JavaScript Ajax
Introduction To JavaScript Ajax
Reema
 
Javascript 01 (js)
Javascript 01 (js)Javascript 01 (js)
Javascript 01 (js)
AbhishekMondal42
 
JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1
Gene Babon
 
Java scriptforjavadev part1
Java scriptforjavadev part1Java scriptforjavadev part1
Java scriptforjavadev part1
Makarand Bhatambarekar
 
Jsp(java server pages)
Jsp(java server pages)Jsp(java server pages)
Jsp(java server pages)
Khan Mac-arther
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
Manisha Keim
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Marlon Jamera
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)
Steve Souders
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
Naresh Chintalcheru
 
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
 
Java script
Java scriptJava script
Java script
umesh patil
 
Java script by Act Academy
Java script by Act AcademyJava script by Act Academy
Java script by Act Academy
actanimation
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
Darshit Metaliya
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
Bhanuka Uyanage
 
Introduction to Javascript By Satyen
Introduction to Javascript By  SatyenIntroduction to Javascript By  Satyen
Introduction to Javascript By Satyen
Satyen Pandya
 

What's hot (20)

Javascript
JavascriptJavascript
Javascript
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js Platform
 
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
In Pursuit of the Holy Grail: Building Isomorphic JavaScript AppsIn Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
 
Introduction To JavaScript Ajax
Introduction To JavaScript AjaxIntroduction To JavaScript Ajax
Introduction To JavaScript Ajax
 
Javascript 01 (js)
Javascript 01 (js)Javascript 01 (js)
Javascript 01 (js)
 
JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1JavaScript Missing Manual, Ch. 1
JavaScript Missing Manual, Ch. 1
 
Java scriptforjavadev part1
Java scriptforjavadev part1Java scriptforjavadev part1
Java scriptforjavadev part1
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 
Jsp(java server pages)
Jsp(java server pages)Jsp(java server pages)
Jsp(java server pages)
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)
 
Java script
Java scriptJava script
Java script
 
Java script by Act Academy
Java script by Act AcademyJava script by Act Academy
Java script by Act Academy
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Introduction to Javascript By Satyen
Introduction to Javascript By  SatyenIntroduction to Javascript By  Satyen
Introduction to Javascript By Satyen
 

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.pptx
Kavitha713564
 
Unit 4 1 web technology uptu
Unit 4 1 web technology uptuUnit 4 1 web technology uptu
Unit 4 1 web technology uptu
Abhishek Kesharwani
 
Unit 4 web technology uptu
Unit 4 web technology uptuUnit 4 web technology uptu
Unit 4 web technology uptu
Abhishek Kesharwani
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
Kalpana T
 
Jsp viva questions
Jsp viva questionsJsp viva questions
Jsp viva questions
Vipul Naik
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practicesejjavies
 
Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
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 - Components
Kaml 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 PAGES
Yoga 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 store
Kavita 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-jsp
sandeep54552
 
Java Servlet
Java ServletJava Servlet
Java Servlet
Yoga Raja
 
Arpita industrial trainingppt
Arpita industrial trainingpptArpita industrial trainingppt
Arpita industrial trainingppt
ARPITA SRIVASTAVA
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet backdoor
 
Web II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentWeb II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side development
Randy Connolly
 

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 1 web technology uptu
Unit 4 1 web technology uptuUnit 4 1 web technology uptu
Unit 4 1 web technology uptu
 
Unit 4 web technology uptu
Unit 4 web technology uptuUnit 4 web technology uptu
Unit 4 web technology uptu
 
Java server pages
Java server pagesJava server pages
Java server pages
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
 
Jsp viva questions
Jsp viva questionsJsp viva questions
Jsp viva questions
 
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
 
Web II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentWeb II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side development
 

More from JayaKamal

To learn Basic Excel - Data Entry, Formulas and Functions
To learn Basic Excel - Data Entry, Formulas and FunctionsTo learn Basic Excel - Data Entry, Formulas and Functions
To learn Basic Excel - Data Entry, Formulas and Functions
JayaKamal
 
Introduction Linked Lists - Singly Linked List,
Introduction Linked Lists - Singly Linked List,Introduction Linked Lists - Singly Linked List,
Introduction Linked Lists - Singly Linked List,
JayaKamal
 
Introduction - Data Structures and Algorithms.ppt
Introduction - Data Structures and Algorithms.pptIntroduction - Data Structures and Algorithms.ppt
Introduction - Data Structures and Algorithms.ppt
JayaKamal
 
What is an Operating Systems?
What is an Operating Systems?What is an Operating Systems?
What is an Operating Systems?
JayaKamal
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
JayaKamal
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
JayaKamal
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
JayaKamal
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
JayaKamal
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
JayaKamal
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
JayaKamal
 

More from JayaKamal (10)

To learn Basic Excel - Data Entry, Formulas and Functions
To learn Basic Excel - Data Entry, Formulas and FunctionsTo learn Basic Excel - Data Entry, Formulas and Functions
To learn Basic Excel - Data Entry, Formulas and Functions
 
Introduction Linked Lists - Singly Linked List,
Introduction Linked Lists - Singly Linked List,Introduction Linked Lists - Singly Linked List,
Introduction Linked Lists - Singly Linked List,
 
Introduction - Data Structures and Algorithms.ppt
Introduction - Data Structures and Algorithms.pptIntroduction - Data Structures and Algorithms.ppt
Introduction - Data Structures and Algorithms.ppt
 
What is an Operating Systems?
What is an Operating Systems?What is an Operating Systems?
What is an Operating Systems?
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
 

Recently uploaded

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

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.