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

Mais conteúdo relacionado

Mais procurados (20)

Jsp
JspJsp
Jsp
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Jsp element
Jsp elementJsp element
Jsp element
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
 
Jsp sasidhar
Jsp sasidharJsp sasidhar
Jsp sasidhar
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 
Java servlets
Java servletsJava servlets
Java servlets
 
Implicit object.pptx
Implicit object.pptxImplicit object.pptx
Implicit object.pptx
 
Jsp presentation
Jsp presentationJsp presentation
Jsp presentation
 
Jsp slides
Jsp slidesJsp slides
Jsp slides
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 

Semelhante a Jsp (java server page)

J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsKaml Sah
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
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
 
Introduction to JSP pages
Introduction to JSP pagesIntroduction to JSP pages
Introduction to JSP pagesFulvio Corno
 
Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00Rajesh Moorjani
 
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.
 
Java Servlet
Java ServletJava Servlet
Java ServletYoga Raja
 
JEE Course - The Web Tier
JEE Course - The Web TierJEE Course - The Web Tier
JEE Course - The Web Tierodedns
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGESKalpana T
 
Java web application development
Java web application developmentJava web application development
Java web application developmentRitikRathaur
 
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Kazuyuki Kawamura
 

Semelhante a Jsp (java server page) (20)

J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
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...
 
JSP overview
JSP overviewJSP overview
JSP overview
 
Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
Jsp in Servlet by Rj
 
Servlets
ServletsServlets
Servlets
 
Introduction to JSP pages
Introduction to JSP pagesIntroduction to JSP pages
Introduction to JSP pages
 
Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00Jeetrainers.com coursejspservlets00
Jeetrainers.com coursejspservlets00
 
Coursejspservlets00
Coursejspservlets00Coursejspservlets00
Coursejspservlets00
 
Asif
AsifAsif
Asif
 
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
 
Beginning In J2EE
Beginning In J2EEBeginning In J2EE
Beginning In J2EE
 
Java Servlet
Java ServletJava Servlet
Java Servlet
 
JEE Course - The Web Tier
JEE Course - The Web TierJEE Course - The Web Tier
JEE Course - The Web Tier
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
 
Introduction to JSP.pptx
Introduction to JSP.pptxIntroduction to JSP.pptx
Introduction to JSP.pptx
 
Java web application development
Java web application developmentJava web application development
Java web application development
 
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
 

Último

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
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
 
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
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
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
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 

Último (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
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
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
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
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
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 🔝✔️✔️
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.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
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.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

Notas do Editor

  1. 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.