SlideShare a Scribd company logo
Java Server PagesJSP, JSTL, and Servlets
TopicsWhat is JSPWhat is JSTLWhat is a Servlet?What are Beans?JSP Access ModelsBenefits and ShortcomingsSamplesQuestions / Comments
What is JSP?JavaServer Pages enable Web developers and designers to rapidly develop and easily maintain, information-rich, dynamic Web pages that leverage existing business systems.JSP technology enables development of Web-based applications that are platform independent.JSP technology separates the user interface from content generation, enabling designers to easily change the overall page layout without altering the underlying dynamic content.
What is JSTL?The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many web applications. single, standard set of tags.JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.Examples:1:<c:forEach var="item“ items="${sessionScope.cart.items}"> 	<tr><td>		<c:out value=“${item.name}”></td>		<td><c:out value=“${item.price}”>	</td></tr></c:forEach>2:<c:choose>   <c:when test='${param.responseText == “Fail"}'>		<b>There was an error!</b>   </c:when>	<c:otherwise>		Everything is great!	</c:otherwise> </c:choose>
What is a Servlet?Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systemsA servlet can almost be thought of as an applet that runs on the server side--without a face. Servlets have access to the entire family of Java APIs, including the JDBC API to access enterprise databases.Servlets can also access a library of HTTP-specific calls and receive all the benefits of the mature Java language, including portability, performance, reusability, and crash protection.Servlet:package silenceit;public class Hello{  public String show(){    return ”Hello”;  }}JSP Page:<%@page import=“silenceit.hello" %><html>  <head>    <title>       Example of page Directive in JSP    </title>  </head>  <body>    <%       Hello he = new Hello();out.print(he.show());     %>  </body></html>
What are Beans?Java Beans are reusable components. They are used to separate Business logic from the Presentation logic. Internally, a bean is just an instance of a class with special naming conventions and characteristics.Bean Conventions:In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.Example Bean:publicclassPersonBeanimplementsjava.io.Serializable {   private String name;   privateboolean deceased;    /** No-arg constructor*/   publicPersonBean() {   }    /** * Property */   public String getName() {returnthis.name;   }    /** * Setter for property Name */publicvoidsetName(final String name) {      this.name = name;   }  /** * Getter for property "deceased" * Different syntax for a boolean field (is vs. get) */   publicbooleanisDeceased() {      returnthis.deceased;   }   /** * Setter for property deceased */publicvoidsetDeceased(finalboolean deceased) {     this.deceased = deceased;   }}
JSP Access ModelsThe early JSP specifications advocated two philosophical approaches, popularly known as Model 1 and Model 2 architectures, for applying JSP technology. These approaches differ essentially in the location at which the bulk of the request processing is performedModel 1Model 2The Model 2 architecture, shown above, is a server-side implementation of the popular Model/View/Controller design pattern. Here, the processing is divided between presentation and front components. Presentation components are JSP pages that generate the HTML/XML response that determines the user interface when rendered by the browser. Front components (also known as controllers) do not handle any presentation issues, but rather, process all the HTTP requestsAlthough the Model 1 architecture is suitable for simple applications, it may not be desirable for complex implementations. Indiscriminate usage of this architecture usually leads to a significant amount of scriptlets or Java code embedded within the JSP page
Benefits and ShortcomingsJSP Benefits:Platform and Server IndependenceOpen Development Process, Open SourceExtensible JSP TagsApplication persistence and variable scopesMature Java languageEasier MaintenanceScripting languages are fine for small applications, but do not scale well to manage large, complex applications. Because the Java language is structured, it is easier to build and maintain large, modular applications with it.JSP technology's emphasis on components over scripting makes it easier to revise content without affecting logic, or revise logic without changing content.The Enterprise JavaBeans architecture encapsulates the enterprise logic, such as database access, security, and transaction integrity, and isolates it from the application itself.Because JSP technology is an open, cross-platform architecture, Web servers, platforms, and other components can be easily upgraded or switched without affecting JSP-based applications. This makes JSP suitable for real-world Web applications, where constant change and growth is the norm.SecuritySince JSP can interoperate with standard Java it has access to the underlying Java SE Platforms extensible security architecture .Security features — cryptography, authentication and authorization, public key infrastructure, and more.JSP Shortcomings:Compiler Required
JSP Typically issues poor error reports

More Related Content

PPT
J2EE and Servlet
PDF
Jsp tutorial
DOC
Servlets and jsp pages best practices
PPTX
J2ee seminar
PPT
Component Framework Primer for JSF Users
PDF
276626961 java-j2 ee-course-curriculum-modular
PPT
JSF 2 and beyond: Keeping progress coming
J2EE and Servlet
Jsp tutorial
Servlets and jsp pages best practices
J2ee seminar
Component Framework Primer for JSF Users
276626961 java-j2 ee-course-curriculum-modular
JSF 2 and beyond: Keeping progress coming

What's hot (20)

PPT
JSP Processing
PDF
Jsf2 overview
PPTX
PPT
Struts 2-overview2
PDF
Jsf+ejb 50
DOCX
Java server pages
PPTX
1.jsp application models
PPT
Java J2EE
ODP
Java Web Programming [1/9] : Introduction to Web Application
PDF
Introduction to Java EE (J2EE)
PDF
JSP Technology I
PDF
Jspx Jdc2010
PPT
Jsp ppt
PDF
Unit 07: Design Patterns and Frameworks (3/3)
PDF
JSP Technology II
PPSX
Entity beans in java
ODP
PPTX
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
PDF
Lecture 8 Enterprise Java Beans (EJB)
PPTX
Jdbc drivers
JSP Processing
Jsf2 overview
Struts 2-overview2
Jsf+ejb 50
Java server pages
1.jsp application models
Java J2EE
Java Web Programming [1/9] : Introduction to Web Application
Introduction to Java EE (J2EE)
JSP Technology I
Jspx Jdc2010
Jsp ppt
Unit 07: Design Patterns and Frameworks (3/3)
JSP Technology II
Entity beans in java
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
Lecture 8 Enterprise Java Beans (EJB)
Jdbc drivers
Ad

Viewers also liked (20)

PPT
Presentation
PPT
Jsp sasidhar
DOCX
Agropecuaria
PDF
Eco eko - listado de ingredientes peligrosos en cosmética
DOCX
Square meter investigation new
PDF
Resume
DOC
Agenda 15
DOC
Agenda 25
PDF
2015 Fall Conference: ISOSWO Lightning Round-Terracon
PPTX
Diapsitivas vicente
PPTX
2015 Fall Conference: Public Meeting, Admin and HR-Brick
PDF
CWP, Dr Ravi
PPT
Projeto Prioritário
PDF
Znaky a symboly
PDF
TREBALL_aRt
PDF
NEW RESUME_F_2016_ERVIN
PDF
2015 Fall Conference: Closed Loop Fund Essentials
PDF
Zethofer Efraim 2015 heb-en
PDF
2015 Fall Conference: Avian Influenza-USDA
PPT
Jsp(java server pages)
Presentation
Jsp sasidhar
Agropecuaria
Eco eko - listado de ingredientes peligrosos en cosmética
Square meter investigation new
Resume
Agenda 15
Agenda 25
2015 Fall Conference: ISOSWO Lightning Round-Terracon
Diapsitivas vicente
2015 Fall Conference: Public Meeting, Admin and HR-Brick
CWP, Dr Ravi
Projeto Prioritário
Znaky a symboly
TREBALL_aRt
NEW RESUME_F_2016_ERVIN
2015 Fall Conference: Closed Loop Fund Essentials
Zethofer Efraim 2015 heb-en
2015 Fall Conference: Avian Influenza-USDA
Jsp(java server pages)
Ad

Similar to JavaServer Pages (20)

PPTX
Learning jsp
PDF
Struts 2 Design and Programming A Tutorial 2nd Edition Budi Kurniawan
PDF
Struts 2 Design and Programming A Tutorial 2nd Edition Budi Kurniawan
PPTX
Platform for Enterprise Solution - Java EE5
PPTX
JSP APP DEVLOPMENT.pptx Related to Android App Development
PPT
Jsp abes new
PPTX
C:\fakepath\jsp01
PPT
J2EE - JSP-Servlet- Container - Components
PPTX
Introduction-to-JSP-Java-Server-Pages.pptx
PPTX
JavaScript, often abbreviated as JS, is a programming language and core techn...
PDF
Enterprise java unit-3_chapter-1-jsp
PPT
PPTX
JAVA SERVER PAGES
PPTX
WT Unit-Vuufvmjn dissimilating Dunkirk k
PPT
Jsp Comparison
PPTX
Jsp basic
PPT
JSP 1.pptdfdfdfdsfdsfdsfdsfdsgdgdgdgdgdd
PPTX
JSP - Java Server Page
DOC
Spatial approximate string search Doc
PPT
Ppt for Online music store
Learning jsp
Struts 2 Design and Programming A Tutorial 2nd Edition Budi Kurniawan
Struts 2 Design and Programming A Tutorial 2nd Edition Budi Kurniawan
Platform for Enterprise Solution - Java EE5
JSP APP DEVLOPMENT.pptx Related to Android App Development
Jsp abes new
C:\fakepath\jsp01
J2EE - JSP-Servlet- Container - Components
Introduction-to-JSP-Java-Server-Pages.pptx
JavaScript, often abbreviated as JS, is a programming language and core techn...
Enterprise java unit-3_chapter-1-jsp
JAVA SERVER PAGES
WT Unit-Vuufvmjn dissimilating Dunkirk k
Jsp Comparison
Jsp basic
JSP 1.pptdfdfdfdsfdsfdsfdsfdsgdgdgdgdgdd
JSP - Java Server Page
Spatial approximate string search Doc
Ppt for Online music store

More from silenceIT Inc. (10)

PPT
PHP6 and HTML5
PPTX
Apache JMeter - A brief introduction
PPT
Google Gears
PPT
Prototype Seminar
PPT
PPT
Bing Webmaster
PPTX
Joomla-Content Management System
ODP
JavaScript Leaks
PPT
JeOS "Juice"
PPT
Quality of Service
PHP6 and HTML5
Apache JMeter - A brief introduction
Google Gears
Prototype Seminar
Bing Webmaster
Joomla-Content Management System
JavaScript Leaks
JeOS "Juice"
Quality of Service

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Approach and Philosophy of On baking technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Machine learning based COVID-19 study performance prediction
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Cloud computing and distributed systems.
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation theory and applications.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Approach and Philosophy of On baking technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
MYSQL Presentation for SQL database connectivity
Machine learning based COVID-19 study performance prediction
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Cloud computing and distributed systems.
Empathic Computing: Creating Shared Understanding
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Monthly Chronicles - July 2025
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation theory and applications.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Network Security Unit 5.pdf for BCA BBA.

JavaServer Pages

  • 1. Java Server PagesJSP, JSTL, and Servlets
  • 2. TopicsWhat is JSPWhat is JSTLWhat is a Servlet?What are Beans?JSP Access ModelsBenefits and ShortcomingsSamplesQuestions / Comments
  • 3. What is JSP?JavaServer Pages enable Web developers and designers to rapidly develop and easily maintain, information-rich, dynamic Web pages that leverage existing business systems.JSP technology enables development of Web-based applications that are platform independent.JSP technology separates the user interface from content generation, enabling designers to easily change the overall page layout without altering the underlying dynamic content.
  • 4. What is JSTL?The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many web applications. single, standard set of tags.JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.Examples:1:<c:forEach var="item“ items="${sessionScope.cart.items}"> <tr><td> <c:out value=“${item.name}”></td> <td><c:out value=“${item.price}”> </td></tr></c:forEach>2:<c:choose> <c:when test='${param.responseText == “Fail"}'> <b>There was an error!</b> </c:when> <c:otherwise> Everything is great! </c:otherwise> </c:choose>
  • 5. What is a Servlet?Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systemsA servlet can almost be thought of as an applet that runs on the server side--without a face. Servlets have access to the entire family of Java APIs, including the JDBC API to access enterprise databases.Servlets can also access a library of HTTP-specific calls and receive all the benefits of the mature Java language, including portability, performance, reusability, and crash protection.Servlet:package silenceit;public class Hello{  public String show(){    return ”Hello”;  }}JSP Page:<%@page import=“silenceit.hello" %><html> <head> <title> Example of page Directive in JSP </title> </head> <body> <% Hello he = new Hello();out.print(he.show()); %> </body></html>
  • 6. What are Beans?Java Beans are reusable components. They are used to separate Business logic from the Presentation logic. Internally, a bean is just an instance of a class with special naming conventions and characteristics.Bean Conventions:In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.Example Bean:publicclassPersonBeanimplementsjava.io.Serializable { private String name; privateboolean deceased; /** No-arg constructor*/ publicPersonBean() { } /** * Property */ public String getName() {returnthis.name; } /** * Setter for property Name */publicvoidsetName(final String name) { this.name = name; } /** * Getter for property "deceased" * Different syntax for a boolean field (is vs. get) */ publicbooleanisDeceased() { returnthis.deceased; } /** * Setter for property deceased */publicvoidsetDeceased(finalboolean deceased) { this.deceased = deceased; }}
  • 7. JSP Access ModelsThe early JSP specifications advocated two philosophical approaches, popularly known as Model 1 and Model 2 architectures, for applying JSP technology. These approaches differ essentially in the location at which the bulk of the request processing is performedModel 1Model 2The Model 2 architecture, shown above, is a server-side implementation of the popular Model/View/Controller design pattern. Here, the processing is divided between presentation and front components. Presentation components are JSP pages that generate the HTML/XML response that determines the user interface when rendered by the browser. Front components (also known as controllers) do not handle any presentation issues, but rather, process all the HTTP requestsAlthough the Model 1 architecture is suitable for simple applications, it may not be desirable for complex implementations. Indiscriminate usage of this architecture usually leads to a significant amount of scriptlets or Java code embedded within the JSP page
  • 8. Benefits and ShortcomingsJSP Benefits:Platform and Server IndependenceOpen Development Process, Open SourceExtensible JSP TagsApplication persistence and variable scopesMature Java languageEasier MaintenanceScripting languages are fine for small applications, but do not scale well to manage large, complex applications. Because the Java language is structured, it is easier to build and maintain large, modular applications with it.JSP technology's emphasis on components over scripting makes it easier to revise content without affecting logic, or revise logic without changing content.The Enterprise JavaBeans architecture encapsulates the enterprise logic, such as database access, security, and transaction integrity, and isolates it from the application itself.Because JSP technology is an open, cross-platform architecture, Web servers, platforms, and other components can be easily upgraded or switched without affecting JSP-based applications. This makes JSP suitable for real-world Web applications, where constant change and growth is the norm.SecuritySince JSP can interoperate with standard Java it has access to the underlying Java SE Platforms extensible security architecture .Security features — cryptography, authentication and authorization, public key infrastructure, and more.JSP Shortcomings:Compiler Required
  • 9. JSP Typically issues poor error reports
  • 10. JSP Pages use more disk space then regular scripting languages
  • 11. Need a solid knowledge of Java
  • 12. Some simple tasks are more difficult to perform
  • 13. Coding standards need to be diligently adhered to
  • 14. Since java programs run in the Java Virtual Machine, they run somewhat slower then applications written in C or C++SamplesPizzapizza.com - FoodTdcanadatrust.com - BankingAmericancentury.com - InvestmentsSportsauthority.com - NewsImagechef.com - FunStjohns.ca - Government