SlideShare a Scribd company logo
Introduction
History of Server
            side scripting




              Java
CGI-Perl                       JSP
            Servlets
CGI (common gateway interface)
1. Scripts are linked and executed on the web
   server.
2. CGI includes Perl, C++, Visual Basic and even
   java.
3. biggest disadvantage to using CGI was that it
   placed a tremendous load on your Web
   server as it is executed on the web server
Java Servlets
               Platform
            Independence

            Performance

                Extensibility

                   Safety

                  Secure
Types of servlet
• Generic Servlet Class (Inherit)
• HttpServlet Class(Inherit)
• Servlet interface (Implement)
HttpServlet       Web
          Request       components


Web
Client


                        JavaBeans
         HttpServlet
                       Components
          Response
Life cycle of Servlet
Import java.io.*;
Import javax.servlet.*;
Import javax.servlet.http.*;
Public class TestServlet extends HttpServlet
{
  public void init() // called only once at start
  {
/* It can be used for those elements which always
  need an initialization like JDBC but it is optional to
  use */
}
Public void
  service/doGet/doPost(HttpServletRequest
  request,HttpServletResponse response)
  throws ServletException , IOException
{
  /* Common method used for initializing JDBC
  ,server based operations and redirect to pages.
 */
Public void destroy() //terminates the servlet
{
  /* rarely used*/
}
}
JSP(Java Server Page)
• Addressing jsp page is simpler than servlets.
• Servlet goes with two pages hand in hand
  like for logging
  login.html (used as an index)
  login.java (used for request and response).
• Only one page enough login.jsp . JSP provides
  better compatibility with web development
  tools.
Difference in code
Java Servlets                   JSP
Class ….                        <html>
{                               ……
   ….                           <%
   out.print(“welcome user”);      out.write(“Login page”);
   out.print(“<body>”);         %>
   ………                          </html>

}
What is JSP ?
Template for a web page that uses java code
 to generate HTML documents dynamically.


 JSP runs in a server side component known
                as JSP container.


JSP Container translates them into equivalent
                  java code.


  JSP is similar to ASP and PHP, but it uses
      the Java programming language.
JSP Fundamentals
•   <% ….. %>   Scriptlets
•   <%! … %>    Declarative
•   <%@...%>    Directive
•   <%= … %>    Expressions
Jsp program
• File name index.jsp
<%@ … %>
<html>
<body>
<form name=“f1” action=“Check.jsp”>
Name :- <input type=“text” name=“name” />
<input type=“submit” name=“submit”
  value=“submit”/>
</form>
</body>
</html>
• Check.jsp
<%@. %>
<html>
<body>
<%
  String nm=request.getParameter(“name”);
%>
<table>
<tr> <td> <% out.write(nm)%> </td>
</tr>
</table>
</body>
</html>
MVC Model
                                  Database
                     Model        Access
Presentation                                      DB
Data                              Model Updates
               User Input
 View          Next View           Controller


                 Delegate State
                 actions


                                  Actions

More Related Content

PPTX
Java Server Pages
PPS
Jsp chapter 1
PPTX
Java Server Pages(jsp)
PPSX
Java server pages
PPT
PDF
PPT
Jsp ppt
PPT
Jsp(java server pages)
Java Server Pages
Jsp chapter 1
Java Server Pages(jsp)
Java server pages
Jsp ppt
Jsp(java server pages)

What's hot (20)

PPTX
PPT
Java Server Pages
PPS
Jsp element
PPTX
java Servlet technology
PPT
Introduction to the Servlet / JSP course
PPT
Jsp sasidhar
PPT
1 java servlets and jsp
PDF
JAVA EE DEVELOPMENT (JSP and Servlets)
PPTX
JSP - Java Server Page
PPTX
Jsp elements
PPTX
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
PPTX
Jsp Introduction Tutorial
PDF
Java servlets
PPTX
Implicit object.pptx
PPTX
Jsp presentation
PPT
Jsp slides
PPTX
Implicit objects advance Java
PPTX
Javax.servlet,http packages
PPTX
Java Server Pages
Java Server Pages
Jsp element
java Servlet technology
Introduction to the Servlet / JSP course
Jsp sasidhar
1 java servlets and jsp
JAVA EE DEVELOPMENT (JSP and Servlets)
JSP - Java Server Page
Jsp elements
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
Jsp Introduction Tutorial
Java servlets
Implicit object.pptx
Jsp presentation
Jsp slides
Implicit objects advance Java
Javax.servlet,http packages
Java Server Pages
Ad

Similar to Jsp (java server page) (20)

PPTX
Advance Java Topics (J2EE)
PPTX
AJppt.pptx
PPT
Ppt for Online music store
PPTX
BITM3730Week12.pptx
DOC
Spatial approximate string search Doc
PPTX
Jsp and Servlets
PPTX
JAVA SERVER PAGES
PPTX
Core web application development
PPTX
Java web application development
PPTX
Server side programming
PDF
Difference between jsf, servlet and jsp
PDF
PPTX
WEB TECHNOLOGY Unit-3.pptx
PPTX
UNIT - 5.pptx Servlets And Database Connectivity
PDF
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
PPT
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
DOCX
Unit 1st and 3rd notes of java
PPTX
Platform for Enterprise Solution - Java EE5
PPT
J2EE - JSP-Servlet- Container - Components
PPT
Servlet123jkhuiyhkjkljioyudfrtsdrestfhgb
Advance Java Topics (J2EE)
AJppt.pptx
Ppt for Online music store
BITM3730Week12.pptx
Spatial approximate string search Doc
Jsp and Servlets
JAVA SERVER PAGES
Core web application development
Java web application development
Server side programming
Difference between jsf, servlet and jsp
WEB TECHNOLOGY Unit-3.pptx
UNIT - 5.pptx Servlets And Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
Unit 1st and 3rd notes of java
Platform for Enterprise Solution - Java EE5
J2EE - JSP-Servlet- Container - Components
Servlet123jkhuiyhkjkljioyudfrtsdrestfhgb
Ad

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Insiders guide to clinical Medicine.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Structure & Organelles in detailed.
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Institutional Correction lecture only . . .
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
human mycosis Human fungal infections are called human mycosis..pptx
VCE English Exam - Section C Student Revision Booklet
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Types and Its function , kingdom of life
Renaissance Architecture: A Journey from Faith to Humanism
Supply Chain Operations Speaking Notes -ICLT Program
Insiders guide to clinical Medicine.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Microbial diseases, their pathogenesis and prophylaxis
Cell Structure & Organelles in detailed.
Final Presentation General Medicine 03-08-2024.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
RMMM.pdf make it easy to upload and study
Institutional Correction lecture only . . .
O7-L3 Supply Chain Operations - ICLT Program
PPH.pptx obstetrics and gynecology in nursing
Module 4: Burden of Disease Tutorial Slides S2 2025
2.FourierTransform-ShortQuestionswithAnswers.pdf

Jsp (java server page)

  • 2. History of Server side scripting Java CGI-Perl JSP Servlets
  • 3. CGI (common gateway interface) 1. Scripts are linked and executed on the web server. 2. CGI includes Perl, C++, Visual Basic and even java. 3. biggest disadvantage to using CGI was that it placed a tremendous load on your Web server as it is executed on the web server
  • 4. Java Servlets Platform Independence Performance Extensibility Safety Secure
  • 5. Types of servlet • Generic Servlet Class (Inherit) • HttpServlet Class(Inherit) • Servlet interface (Implement)
  • 6. HttpServlet Web Request components Web Client JavaBeans HttpServlet Components Response
  • 7. Life cycle of Servlet Import java.io.*; Import javax.servlet.*; Import javax.servlet.http.*; Public class TestServlet extends HttpServlet { public void init() // called only once at start {
  • 8. /* It can be used for those elements which always need an initialization like JDBC but it is optional to use */ } Public void service/doGet/doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException , IOException { /* Common method used for initializing JDBC ,server based operations and redirect to pages. */
  • 9. Public void destroy() //terminates the servlet { /* rarely used*/ } }
  • 10. JSP(Java Server Page) • Addressing jsp page is simpler than servlets. • Servlet goes with two pages hand in hand like for logging login.html (used as an index) login.java (used for request and response). • Only one page enough login.jsp . JSP provides better compatibility with web development tools.
  • 11. Difference in code Java Servlets JSP Class …. <html> { …… …. <% out.print(“welcome user”); out.write(“Login page”); out.print(“<body>”); %> ……… </html> }
  • 12. What is JSP ? Template for a web page that uses java code to generate HTML documents dynamically. JSP runs in a server side component known as JSP container. JSP Container translates them into equivalent java code. JSP is similar to ASP and PHP, but it uses the Java programming language.
  • 13. JSP Fundamentals • <% ….. %> Scriptlets • <%! … %> Declarative • <%@...%> Directive • <%= … %> Expressions
  • 14. Jsp program • File name index.jsp <%@ … %> <html> <body> <form name=“f1” action=“Check.jsp”> Name :- <input type=“text” name=“name” /> <input type=“submit” name=“submit” value=“submit”/>
  • 16. • Check.jsp <%@. %> <html> <body> <% String nm=request.getParameter(“name”); %> <table> <tr> <td> <% out.write(nm)%> </td> </tr>
  • 18. MVC Model Database Model Access Presentation DB Data Model Updates User Input View Next View Controller Delegate State actions Actions

Editor's Notes

  • #5: Platform IndependenceServlets are written entirely in java so these are platform independent. Servlets can run on any Servlet enabled web server. For example if you develop an web application in windows machine running Java web server, you can easily run the same on apache web server (if Apache Serve is installed) without modification or compilation of code. Platform independency of servlets provide a great advantages over alternatives of servlets.PerformanceDue to interpreted nature of java, programs written in java are slow. But the java servlets runs very fast. These are due to the way servlets run on web server. For any program initialization takes significant amount of time. But in case of servlets initialization takes place first time it receives a request and remains in memory till times out or server shut downs. After servlet is loaded, to handle a new request it simply creates a new thread and runs service method of servlet. In comparison to traditional CGI scripts which creates a new process to serve the request. ExtensibilityJava Servlets are developed in java which is robust, well-designed and object oriented language which can be extended or polymorphed into new objects. So the java servlets take all these advantages and can be extended from existing class to provide the ideal solutions.SafetyJava provides very good safety features like memory management, exception handling etc. Servlets inherits all these features and emerged as a very powerful web server extension.SecureServlets are server side components, so it inherits the security provided by the web server. Servlets are also benefited with Java Security Manager.