SlideShare a Scribd company logo
Java Server Pages
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
CGI
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
Servlet Servlets are   java programs   that run on web servers. Servlets have benefits that are   platform   independent ,  portable .
How Servlet works? Browser Web Server .java files Operating System Operating System HTTP Request HTML Servlet Engine Data Files JVM
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
What is JSP ? JavaServer Pages is a java-based technology for developing web pages that include   dynamic   content.  based on user input, time of day, or any other runtime conditions. A JSP page is a   HTML pages   with   JSP elements   for generating the parts of the page that differ for each request.
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
JSP Processing
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
JSP Elements Comments Scripting Elements Scriptlets Expressions Declarations Directives Actions
JSP Comment  HTML   comment will appear in the output stream to the browser <!-- comments … -- > JSP   comment will not be processed by the JSP compiler <%-- comments … --%>
Scripting Elements Scriptlets Expressions Declarations
<%  Scriptlets  %> A Scriptlet element is simply a section of Java code encapsulated within the opening and closing   standard JSP tags . JSP Syntax: <% code %>
<%  Example  %>
<%= Expressions %> An Expression element is a Java language expression whose value is evaluated and returned as a string to the page. JSP Syntax:  <%= code %>
<%= Example %>
<%! Declarations %> A Declaration element is used to declare methods and variables that are initialized with the page. JSP Syntax:  <%! code %>
<%! Example %>
Directives JSP directives are used to send messages to the JSP engine.  Directives general syntax   <%@ directive  attribute=“value”%> The Page Directive The Include Directive The Taglib Directive
<%@ Page %> Used for importing classes and setting up content type. EX: imports the java.utilCalendar class <%@ page import=&quot;java.util.Calendar&quot; %> sets the contentType <%@ page contentType=&quot;text/html&quot; %>
<%@  include  %> Used for inserting a file to the servlet when the JSP page is translated to a servlet. EX: <%@ include file=&quot;footer.jsp&quot; %> <%@include file = &quot;/products/examples/listing.html&quot; %>
<%@ Taglib %> It tells the JSP engine that this JSP page uses a tag library. It specifies the location of a special jar file containing a Tag Library Descriptor. EX: <%@ taglib uri=&quot; http://www.javadesktop.com/sampletags.jar &quot; prefix=&quot; sample &quot; %> <sample:tagAction>  This is an example  </sample:tagAction>
Actions Ex: <jsp:useBean>   imports a JavaBeans component. <jsp:getProperty>   gets a property value and adds it to the response. <jsp:setProperty>   sets a property value.
Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
What Is a Bean? JavaBeans are regular Java classes designed according to the set of guidelines defined by the JavaBeans specification
Bean properties  A bean class must have a no-argument constructor. The bean class should implement the   java.io.Serializable  . Data held by a bean is referred to as the bean's  properties . The property name is case-sensitive and always starts with a lowercase letter. A property is either read-only, write-only or read/write, and has a value corresponding to a specific Java data type (for instance   String,java.util.Date, or int ) .
Bean properties Cont. The bean properties are accessed through   ( accessor  methods   )   getter   and   setter   methods.  Getter and setter method names are composed of the word  get  or  set , respectively, plus the property name, with the first character of each word capitalized.  A   getter   method has no arguments and returns a value of the property's type, while a   setter   method takes a single argument of the property's type and has a void return type.
Bean Example
Declaring a Bean in a JSP Page ? Before you use a bean in a page, you must tell the JSP container which type of bean it is and associate it with a name: in other words, you must declare the bean.
basic tags for working with Beans  JSP provide three basic tags for working with Beans : <jsp:useBean > <jsp:setProperty > <jsp:getProperty > These three tags are JSP standard actions.
<jsp:useBean > <jsp:useBean   id =“ bean name ”   class =“bean class”/> EX: <jsp:useBean id=&quot;cartoon&quot; class=&quot;com.ora.jsp.beans.motd.CartoonBean&quot; />
<jsp:setProperty > <jsp:setProperty   name   = “id”   property   =“someProperty”   value =“someValue”/> id   = the name of the bean as specified in the useBean tag.   property   = name of the property to be passed to the bean.  value   = value of that particular property EX : <jsp:setProperty name=&quot; cartoon &quot; property=&quot; fileName“ value=“Books&quot; />
<jsp:getProperty > <jsp:getProperty   name   = “id”   property   = “someProperty” />   This action obtains the current value of a bean property and inserts it directly into the response body. EX: <jsp:getProperty name=&quot;cartoon&quot; property=&quot;fileName&quot; />
Example
Demos
Question ?

More Related Content

PPT
KMUTNB - Internet Programming 5/7
PPTX
Learning jsp
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
PPTX
PPTX
Jsp , javasportal, jsp basic,
PPT
Facelets
ZIP
Presentation.Key
KMUTNB - Internet Programming 5/7
Learning jsp
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Jsp , javasportal, jsp basic,
Facelets
Presentation.Key

What's hot (19)

PDF
Lap trinh web [Slide jsp]
PPTX
Jsp session 5
PPTX
5 Reasons To Love CodeIgniter
PPT
Web&java. jsp
PPT
jQuery Intro
PPT
Advanced Views with Erector
PPTX
Ruby on Rails + AngularJS + Twitter Bootstrap
PPTX
I Love codeigniter, You?
PPTX
Custom Action Framework
PDF
Ch. 7 beeing a jsp
PDF
Damage Control
ODP
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
PDF
Be happy with Ruby on Rails - CEUNSP Itu
ODP
Modularizing Rails Apps with Cells
PPTX
Java Course Day 21
PDF
Telling Stories With RSpec
PDF
Being a jsp
DOCX
Filters in AngularJS
Lap trinh web [Slide jsp]
Jsp session 5
5 Reasons To Love CodeIgniter
Web&java. jsp
jQuery Intro
Advanced Views with Erector
Ruby on Rails + AngularJS + Twitter Bootstrap
I Love codeigniter, You?
Custom Action Framework
Ch. 7 beeing a jsp
Damage Control
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Be happy with Ruby on Rails - CEUNSP Itu
Modularizing Rails Apps with Cells
Java Course Day 21
Telling Stories With RSpec
Being a jsp
Filters in AngularJS
Ad

Viewers also liked (20)

PPT
Jsp ppt
PPT
Jsp sasidhar
PPTX
4. jsp
PDF
xampp_server
PDF
Joomla!: phpMyAdmin for Beginners
DOCX
Using XAMPP
PPS
Jsp element
PDF
phpMyAdmin con Xampp
PPTX
Introducing the MySQL Workbench CASE tool
PPT
PPTX
Jsp Introduction Tutorial
PPT
Jsp/Servlet
PPTX
Java/Servlet/JSP/JDBC
PPTX
MySQL Database with phpMyAdmin
PPTX
Introduction to xampp
PPTX
Jsp presentation
PDF
Java Web Programming [4/9] : JSP Basic
PDF
Xampp installation
Jsp ppt
Jsp sasidhar
4. jsp
xampp_server
Joomla!: phpMyAdmin for Beginners
Using XAMPP
Jsp element
phpMyAdmin con Xampp
Introducing the MySQL Workbench CASE tool
Jsp Introduction Tutorial
Jsp/Servlet
Java/Servlet/JSP/JDBC
MySQL Database with phpMyAdmin
Introduction to xampp
Jsp presentation
Java Web Programming [4/9] : JSP Basic
Xampp installation
Ad

Similar to Jsp Presentation +Mufix "3" (20)

PPT
KMUTNB - Internet Programming 5/7
PPT
PPTX
C:\fakepath\jsp01
PPT
PPT
Java Server Pages
PPTX
Introduction - Java Server Programming (JSP)
PPTX
Introduction to JSP.pptx
PPT
Jsp 02(jsp directives)2003
PPTX
PPTX
JSP AND XML USING JAVA WITH GET AND POST METHODS
PPSX
Java server pages
PPT
29 Jsp
DOC
DOC
PPTX
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
PPTX
Module 3.pptx.............................
PPTX
JSP.pptx
PPTX
JSP.pptx programming guide for beginners and experts
PPTX
JSP- JAVA SERVER PAGES
KMUTNB - Internet Programming 5/7
C:\fakepath\jsp01
Java Server Pages
Introduction - Java Server Programming (JSP)
Introduction to JSP.pptx
Jsp 02(jsp directives)2003
JSP AND XML USING JAVA WITH GET AND POST METHODS
Java server pages
29 Jsp
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Module 3.pptx.............................
JSP.pptx
JSP.pptx programming guide for beginners and experts
JSP- JAVA SERVER PAGES

More from SiliconExpert Technologies (20)

PDF
Game Programming By J2me
PPS
Linux Administration
PPT
How To Get Your First Job
PPT
Joomla Presentations
PPT
Mufix Network Programming Lecture
PDF
Javafx Overview 90minutes
PDF
Javafx Overview 90minutes
PDF
Javafx Overview 90minutes
PDF
Javanowandfuture Chihuahua
PPT
Google Summer of Code
PDF
PDF
Joining Osum Community And ..
PPT
Develop Your Skills With Osum
PDF
Sfd Post Event Report
ODP
Linux Presentation
PDF
I Phone Session Mufix
PPT
PDF
Introduction To Programming (2009 2010)
Game Programming By J2me
Linux Administration
How To Get Your First Job
Joomla Presentations
Mufix Network Programming Lecture
Javafx Overview 90minutes
Javafx Overview 90minutes
Javafx Overview 90minutes
Javanowandfuture Chihuahua
Google Summer of Code
Joining Osum Community And ..
Develop Your Skills With Osum
Sfd Post Event Report
Linux Presentation
I Phone Session Mufix
Introduction To Programming (2009 2010)

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Electronic commerce courselecture one. Pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Digital-Transformation-Roadmap-for-Companies.pptx
Unlocking AI with Model Context Protocol (MCP)
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Chapter 3 Spatial Domain Image Processing.pdf
Review of recent advances in non-invasive hemoglobin estimation
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Electronic commerce courselecture one. Pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Jsp Presentation +Mufix "3"

  • 2. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 3. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 4. CGI
  • 5. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 6. Servlet Servlets are java programs that run on web servers. Servlets have benefits that are platform independent , portable .
  • 7. How Servlet works? Browser Web Server .java files Operating System Operating System HTTP Request HTML Servlet Engine Data Files JVM
  • 8. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 9. What is JSP ? JavaServer Pages is a java-based technology for developing web pages that include dynamic content. based on user input, time of day, or any other runtime conditions. A JSP page is a HTML pages with JSP elements for generating the parts of the page that differ for each request.
  • 10. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 12. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 13. JSP Elements Comments Scripting Elements Scriptlets Expressions Declarations Directives Actions
  • 14. JSP Comment HTML comment will appear in the output stream to the browser <!-- comments … -- > JSP comment will not be processed by the JSP compiler <%-- comments … --%>
  • 15. Scripting Elements Scriptlets Expressions Declarations
  • 16. <% Scriptlets %> A Scriptlet element is simply a section of Java code encapsulated within the opening and closing standard JSP tags . JSP Syntax: <% code %>
  • 18. <%= Expressions %> An Expression element is a Java language expression whose value is evaluated and returned as a string to the page. JSP Syntax: <%= code %>
  • 20. <%! Declarations %> A Declaration element is used to declare methods and variables that are initialized with the page. JSP Syntax: <%! code %>
  • 22. Directives JSP directives are used to send messages to the JSP engine. Directives general syntax <%@ directive attribute=“value”%> The Page Directive The Include Directive The Taglib Directive
  • 23. <%@ Page %> Used for importing classes and setting up content type. EX: imports the java.utilCalendar class <%@ page import=&quot;java.util.Calendar&quot; %> sets the contentType <%@ page contentType=&quot;text/html&quot; %>
  • 24. <%@ include %> Used for inserting a file to the servlet when the JSP page is translated to a servlet. EX: <%@ include file=&quot;footer.jsp&quot; %> <%@include file = &quot;/products/examples/listing.html&quot; %>
  • 25. <%@ Taglib %> It tells the JSP engine that this JSP page uses a tag library. It specifies the location of a special jar file containing a Tag Library Descriptor. EX: <%@ taglib uri=&quot; http://www.javadesktop.com/sampletags.jar &quot; prefix=&quot; sample &quot; %> <sample:tagAction> This is an example </sample:tagAction>
  • 26. Actions Ex: <jsp:useBean> imports a JavaBeans component. <jsp:getProperty> gets a property value and adds it to the response. <jsp:setProperty> sets a property value.
  • 27. Agenda CGI Servlet What is JSP ? JSP Processing JSP elements How to use beans with JSP ?
  • 28. What Is a Bean? JavaBeans are regular Java classes designed according to the set of guidelines defined by the JavaBeans specification
  • 29. Bean properties A bean class must have a no-argument constructor. The bean class should implement the java.io.Serializable . Data held by a bean is referred to as the bean's properties . The property name is case-sensitive and always starts with a lowercase letter. A property is either read-only, write-only or read/write, and has a value corresponding to a specific Java data type (for instance String,java.util.Date, or int ) .
  • 30. Bean properties Cont. The bean properties are accessed through ( accessor methods ) getter and setter methods. Getter and setter method names are composed of the word get or set , respectively, plus the property name, with the first character of each word capitalized. A getter method has no arguments and returns a value of the property's type, while a setter method takes a single argument of the property's type and has a void return type.
  • 32. Declaring a Bean in a JSP Page ? Before you use a bean in a page, you must tell the JSP container which type of bean it is and associate it with a name: in other words, you must declare the bean.
  • 33. basic tags for working with Beans JSP provide three basic tags for working with Beans : <jsp:useBean > <jsp:setProperty > <jsp:getProperty > These three tags are JSP standard actions.
  • 34. <jsp:useBean > <jsp:useBean id =“ bean name ” class =“bean class”/> EX: <jsp:useBean id=&quot;cartoon&quot; class=&quot;com.ora.jsp.beans.motd.CartoonBean&quot; />
  • 35. <jsp:setProperty > <jsp:setProperty name = “id” property =“someProperty” value =“someValue”/> id = the name of the bean as specified in the useBean tag. property = name of the property to be passed to the bean. value = value of that particular property EX : <jsp:setProperty name=&quot; cartoon &quot; property=&quot; fileName“ value=“Books&quot; />
  • 36. <jsp:getProperty > <jsp:getProperty name = “id” property = “someProperty” /> This action obtains the current value of a bean property and inserts it directly into the response body. EX: <jsp:getProperty name=&quot;cartoon&quot; property=&quot;fileName&quot; />
  • 38. Demos