SlideShare a Scribd company logo
JAVA SERVER PAGES
by Tanmoy Barman
cont:-
barmantanmoy.47@gmail.com
DISCUSSIONS
 Introduction
 JSP vs. ASP
 JSP life cycles
 JSP errors
 JSP comments
 JSP elements; Directives, Scripting, Actions
 JSP implicit objects
 Example of writing JSP
 Java Bean
INTRODUCTION
 JSP is a technology based in java which produces dynamic web
pages.
 JSP is a server side scripting language technology created by
sun micro systems.
 JSP files are html files which contains special tags where java
code is embedded into it.
 JSP have .jsp extension.
JSP VS. ASP
 JSP is technology introduced by Sun micro systems where as
ASP is a technology introduced y Microsoft.
 JSP is abbreviation of JAVA SERVER PAGES and ASP is
abbreviation of ACTIVE SERVER PAGES
 ASP pages can connect to my sql & ms Access databases and
also can connect to other database with the help of ADO
whereas JSP can connect to any database loading the
appropriate driver when needed.
JSP VS. ASP
 ASP runs on Microsoft IIS server which run on Microsoft
operating system where as JSP can run on any Linux based
server, IBM JBOSS as well as in Microsoft platform.
 ASP is an interpreted language, JSP can interpreted as well as
compiled.
 JSP is free of cost including JSP server where as ASP is free
but running ASP on Microsoft IIS server cost money.
JSP LIFE CYCLES
 JSP are deployed in the web server as servlet.
 The JSP page is compiled to servlet by JSP engine, eliminating
the html tags and putting them inside out.println() statements
and removing the jsp tags.
 Once it is translated into servlet then the servlet, then it
follows the servlet lifecycles.
JSP LIFE CYCLES
JSP ERRORS
 Three types of error can be evolved in JSP:-
 Jsp error; which occurs when jsp is translated to servlet.
 Java code error; occurs when the servlet is complied to java class.
 HTML error; occurs during the presentation of html pages in the
browser.
JSP ERRORS
 The first two errors (jsp error and java code error) is detected
by the application server.
 The HTML error is detected by the web browser.
JSP COMMENTS
 Comments can be include in the jsp page, follows:-
 <%-- --%>
 </* */>
 <!-- --!>
JSP ELEMENTS
 The elements in jsp contains the tags, each having special
meanings, containing java codes which tells the jsp engine
what/how dynamic output has to processed.
 There are three types of elements:-
 Directives
 Scripting
 Action
DIRECTIVES
 Directives:- This tag is used to convey special information
about the page to the jsp engine.
 Syntax:-
 <%@ %>
 Three kinds of Directives are available:-
 page
 include
 tag library
DIRECTIVES
 page directive ; this directive informs the jsp engine about the
headers and facilities that the page should get from the
environment.
 There can be any number of page directives in a jsp page.
 Declared usually at the top.
 Syntax:-
 <%@page attribute= %>
 Attributes can be; include, import, session, etc.
 Example; <%@page import=“package_name”%>
DIRECTIVES
 Include directive ; this is used to statically include one or
more resources to the jsp page.
 This allows the jsp developer to reuse the code.
 Syntax:-
 <%@include page=“”%>
 There is only on attribute named „page‟ in include directive.
SCRIPTING ELEMENTS
 Scripting Elements; contains embedded java code.
 There are three types:-
 Declarations
 Expression
 Scriplets
SCRIPTING ELEMENTS
 Declarations; this tag allows the developer to declare one or
multiple variable and methods.
 They do not produce any output.
 Syntax:-
 <%! %>
 Example:- <%! public String name;
public int age;
public void setDetail(name,age); %>
SCRIPTING ELEMENTS
 Expression; this tag allows the developer to embed single java
expression which is not terminated by a semi colon.
 Syntax:-
 <%= %>
 Example:- <%= new java.util.Date() %>
SCRIPTING ELEMENTS
 Scriplets; this tag allows the developer to embedded java code
inside it that can use the variable declared earlier.
 Syntax:-
 <% %>
 Example:- <% int sum=a+b;
system.out.println(sum);
%>
ACTION ELEMENT
 Functions provided like:-
 Use of java bean technology in jsp page.
 Browser independent support for applet.
 Transfers control among pages.
 Syntax:-
 <jsp: />
ACTION ELEMENT
 Standard action tag are:-
 useBean
 setProperty
 getProperty
 param
 include
 forward
 plugin
JSP IMPLICIT OBJECTS
 There are certain objects in jsp that can be used in jsp page without being
declared these are Implicit objects. There are nine implicit object in JSP:-
 application
 page
 pageContext
 config
 session
 exception
 request
 response
 out
EXAMPLE OF JSP
 A simple jsp program to show date using scriplets;” teddyTest.jsp”
<html>
<head>
</head>
<body>
<h1>JSP Page to show today Date </h1>
<% out.println(new java.util.Date()); %>
</body>
</html>
EXAMPLE OF JSP
 Now we will use the implicit object to get values from a html page.
 This is a html page to take user inputs “Impli.html”
<html>
<body>
<form ACTION=“ImpliShow.jsp”>
Name=<input type=“text” name=“nm”>
<input type=“submit”>
</form>
</body>
</html>
EXAMPLE OF JSP
 ImpliShow.jsp
<html>
<body>
<%
String nm=request.getParameter("usr");
String ag=request.getParameter("age");
out.println (“name:”+nm+””+age:”+ag);
%>
</body>
</html>
JAVA BEAN
 Java bean is a self contained class file in java which typically
contains;
 No argument constructor.
 Is seriliziable.
 Have getter and setter methods to get and set values of the
properties.
 According to java white papers java beans are reusable
component in java, and they combine various objects into a
single one which can be accessed by multiple user.
JAVA BEAN
 Jsp use three action tag for use of java bean technology:-
 useBean=used to locate or instantiate a bean class.
 setProperty=set the property value or values of a bean class.
 getProperty=get the property values of a bean class, first the
property values are converted into string and then added to the
request stream.
JAVA BEAN
 <jsp:useBean id= "instanceName" scope= "page | request |
session | application"
class= "packageName.className"
type= "packageName.className“
beanName=“ packgeName.className | <%= expression >" >
</jsp:useBean>
JAVA BEAN
 Example of useBean action tag in jsp:-
 Class student{
private String name;
Private int age;
public void setName(string n){
name=n;}
publci void setAge(int a){
age=n;}
}
JAVA BEAN
 A html page named bean.html
<html>
<body>
<form ACTION=“teddyBean.jsp”>
Name=<input type=“text” name=“nm”>
<input type=“submit”>
</form>
</body>
</html>
JAVA BEAN
 A jsp page named teddyBean.jsp
<html>
<body>
<jsp:useBean id=“obj” class=“student”>
<%
Sting n=request.getParameter(“name”);
obj.setName(n);
system.out.println(obj.getName());
%>
</body>
</html>
JAVA BEAN
 <jsp:setProperty name="instanceOfBean" property= "*" |
property="propertyName" param="parameterName" |
property="propertyName" value="{ string | <%= expression
%>}" />
 <jsp:getProperty name="instanceOfBean"
property="propertyName" />
JAVA BEAN
 <jsp:setProperty name=“obj" property="name" value="*" />
 To set all the values of the property.
 <jsp:setProperty name=“obj” property=“_property”
value=“_value” />
 To set a particular property with a value.
JAVA BEAN
 Example of setProperty and getProperty action tag:-
Package teddyPack
public class jB {
private String name;
private int age;
public void setAge(int age){this.age=age;}
public void setName(String name){this.name=name;}
public String getName(){return name;}
public int getAge(){ return age;}
}
JAVA BEAN
 A html page named “setGET.html”
<html>
<body>
<form ACTION=“setGet.jsp”>
Name:<input type=“text” name=“name”>
Age:<input type=“text” name=“age”>
<input type=“submit”>
</form>
</body></html>
JAVA BEAN
 A jsp page named “setGet.jsp”
<html>
<body>
<jsp:useBean id="ted" class="teddyPack.jB" />
<% String n=request.getParameter("name");%>
<jsp:setProperty name="ted" property="name" value="*" />
<b>HELLO</b><jsp:getProperty name="ted" property="name"/>; aged
<jsp:getProperty name=“ted” property=“age”/>
</body>
</html>
THANK YOU

More Related Content

What's hot

Jsp sasidhar
Jsp sasidharJsp sasidhar
Jsp sasidhar
Sasidhar Kothuru
 
Jsp chapter 1
Jsp chapter 1Jsp chapter 1
Jsp chapter 1
kamal kotecha
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
Talha Ocakçı
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
APSMIND TECHNOLOGY PVT LTD.
 
Jsp element
Jsp elementJsp element
Jsp element
kamal kotecha
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
Manisha Keim
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Jsp servlets
Jsp servletsJsp servlets
Jsp servlets
Rajavel Dhandabani
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
JavaEE Trainers
 
Java Servlets
Java ServletsJava Servlets
Java ServletsNitin Pai
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
Tanmoy Barman
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
Nuha Noor
 
Java servlets
Java servletsJava servlets
Java servlets
Mukesh Tekwani
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packagesvamsi krishna
 
Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servlets
JavaEE Trainers
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
Kaml Sah
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
BG Java EE Course
 
Servlet and jsp interview questions
Servlet and jsp interview questionsServlet and jsp interview questions
Servlet and jsp interview questions
Sujata Regoti
 

What's hot (20)

Jsp sasidhar
Jsp sasidharJsp sasidhar
Jsp sasidhar
 
Jsp chapter 1
Jsp chapter 1Jsp chapter 1
Jsp chapter 1
 
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 Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 
Jsp element
Jsp elementJsp element
Jsp element
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
Jsp servlets
Jsp servletsJsp servlets
Jsp servlets
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
 
Java servlets
Java servletsJava servlets
Java servlets
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servlets
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
JDBC in Servlets
JDBC in ServletsJDBC in Servlets
JDBC in Servlets
 
Servlet and jsp interview questions
Servlet and jsp interview questionsServlet and jsp interview questions
Servlet and jsp interview questions
 

Similar to Java server pages

Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
JSP.pptx
JSP.pptxJSP.pptx
JSP.pptx
NishaRohit6
 
WEB TECHNOLOGIES JSP
WEB TECHNOLOGIES  JSPWEB TECHNOLOGIES  JSP
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
vishal choudhary
 
Introduction to JSP.pptx
Introduction to JSP.pptxIntroduction to JSP.pptx
Introduction to JSP.pptx
ManishaPatil932723
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
Yoga Raja
 
anatomy of a jsp page & jsp syntax.pptx
anatomy of a jsp page & jsp syntax.pptxanatomy of a jsp page & jsp syntax.pptx
anatomy of a jsp page & jsp syntax.pptx
Sameenafathima4
 
Jsp
JspJsp
Java Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP BasicJava Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP Basic
IMC Institute
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
WebStackAcademy
 
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
 
Jsp
JspJsp
SCWCD : Java server pages CHAP : 9
SCWCD : Java server pages  CHAP : 9SCWCD : Java server pages  CHAP : 9
SCWCD : Java server pages CHAP : 9
Ben Abdallah Helmi
 
Spatial approximate string search Doc
Spatial approximate string search DocSpatial approximate string search Doc
Spatial approximate string search Doc
Sudha Hari Tech Solution Pvt ltd
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
Kalpana T
 

Similar to Java server pages (20)

Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
Jsp in Servlet by Rj
 
JSP.pptx
JSP.pptxJSP.pptx
JSP.pptx
 
WEB TECHNOLOGIES JSP
WEB TECHNOLOGIES  JSPWEB TECHNOLOGIES  JSP
WEB TECHNOLOGIES JSP
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
 
Jsp tutorial
Jsp tutorialJsp tutorial
Jsp tutorial
 
Introduction to JSP.pptx
Introduction to JSP.pptxIntroduction to JSP.pptx
Introduction to JSP.pptx
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
 
anatomy of a jsp page & jsp syntax.pptx
anatomy of a jsp page & jsp syntax.pptxanatomy of a jsp page & jsp syntax.pptx
anatomy of a jsp page & jsp syntax.pptx
 
Jsp
JspJsp
Jsp
 
Jsp
JspJsp
Jsp
 
Java server pages
Java server pagesJava server pages
Java server pages
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
Java Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP BasicJava Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP Basic
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...
 
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
 
Jsp
JspJsp
Jsp
 
SCWCD : Java server pages CHAP : 9
SCWCD : Java server pages  CHAP : 9SCWCD : Java server pages  CHAP : 9
SCWCD : Java server pages CHAP : 9
 
Spatial approximate string search Doc
Spatial approximate string search DocSpatial approximate string search Doc
Spatial approximate string search Doc
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
 

More from Tanmoy Barman

Java rmi
Java rmiJava rmi
Java rmi
Tanmoy Barman
 
Jini
JiniJini
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
Web apps architecture
Web apps architectureWeb apps architecture
Web apps architecture
Tanmoy Barman
 
introduction to channel borrowing scheme in cellular networks
introduction to channel borrowing scheme in cellular networksintroduction to channel borrowing scheme in cellular networks
introduction to channel borrowing scheme in cellular networks
Tanmoy Barman
 
INTRODUCTION TO CLOUD COMPUTING
INTRODUCTION TO CLOUD COMPUTINGINTRODUCTION TO CLOUD COMPUTING
INTRODUCTION TO CLOUD COMPUTING
Tanmoy Barman
 

More from Tanmoy Barman (6)

Java rmi
Java rmiJava rmi
Java rmi
 
Jini
JiniJini
Jini
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Web apps architecture
Web apps architectureWeb apps architecture
Web apps architecture
 
introduction to channel borrowing scheme in cellular networks
introduction to channel borrowing scheme in cellular networksintroduction to channel borrowing scheme in cellular networks
introduction to channel borrowing scheme in cellular networks
 
INTRODUCTION TO CLOUD COMPUTING
INTRODUCTION TO CLOUD COMPUTINGINTRODUCTION TO CLOUD COMPUTING
INTRODUCTION TO CLOUD COMPUTING
 

Recently uploaded

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 

Recently uploaded (20)

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 

Java server pages

  • 1. JAVA SERVER PAGES by Tanmoy Barman cont:- barmantanmoy.47@gmail.com
  • 2. DISCUSSIONS  Introduction  JSP vs. ASP  JSP life cycles  JSP errors  JSP comments  JSP elements; Directives, Scripting, Actions  JSP implicit objects  Example of writing JSP  Java Bean
  • 3. INTRODUCTION  JSP is a technology based in java which produces dynamic web pages.  JSP is a server side scripting language technology created by sun micro systems.  JSP files are html files which contains special tags where java code is embedded into it.  JSP have .jsp extension.
  • 4. JSP VS. ASP  JSP is technology introduced by Sun micro systems where as ASP is a technology introduced y Microsoft.  JSP is abbreviation of JAVA SERVER PAGES and ASP is abbreviation of ACTIVE SERVER PAGES  ASP pages can connect to my sql & ms Access databases and also can connect to other database with the help of ADO whereas JSP can connect to any database loading the appropriate driver when needed.
  • 5. JSP VS. ASP  ASP runs on Microsoft IIS server which run on Microsoft operating system where as JSP can run on any Linux based server, IBM JBOSS as well as in Microsoft platform.  ASP is an interpreted language, JSP can interpreted as well as compiled.  JSP is free of cost including JSP server where as ASP is free but running ASP on Microsoft IIS server cost money.
  • 6. JSP LIFE CYCLES  JSP are deployed in the web server as servlet.  The JSP page is compiled to servlet by JSP engine, eliminating the html tags and putting them inside out.println() statements and removing the jsp tags.  Once it is translated into servlet then the servlet, then it follows the servlet lifecycles.
  • 8. JSP ERRORS  Three types of error can be evolved in JSP:-  Jsp error; which occurs when jsp is translated to servlet.  Java code error; occurs when the servlet is complied to java class.  HTML error; occurs during the presentation of html pages in the browser.
  • 9. JSP ERRORS  The first two errors (jsp error and java code error) is detected by the application server.  The HTML error is detected by the web browser.
  • 10. JSP COMMENTS  Comments can be include in the jsp page, follows:-  <%-- --%>  </* */>  <!-- --!>
  • 11. JSP ELEMENTS  The elements in jsp contains the tags, each having special meanings, containing java codes which tells the jsp engine what/how dynamic output has to processed.  There are three types of elements:-  Directives  Scripting  Action
  • 12. DIRECTIVES  Directives:- This tag is used to convey special information about the page to the jsp engine.  Syntax:-  <%@ %>  Three kinds of Directives are available:-  page  include  tag library
  • 13. DIRECTIVES  page directive ; this directive informs the jsp engine about the headers and facilities that the page should get from the environment.  There can be any number of page directives in a jsp page.  Declared usually at the top.  Syntax:-  <%@page attribute= %>  Attributes can be; include, import, session, etc.  Example; <%@page import=“package_name”%>
  • 14. DIRECTIVES  Include directive ; this is used to statically include one or more resources to the jsp page.  This allows the jsp developer to reuse the code.  Syntax:-  <%@include page=“”%>  There is only on attribute named „page‟ in include directive.
  • 15. SCRIPTING ELEMENTS  Scripting Elements; contains embedded java code.  There are three types:-  Declarations  Expression  Scriplets
  • 16. SCRIPTING ELEMENTS  Declarations; this tag allows the developer to declare one or multiple variable and methods.  They do not produce any output.  Syntax:-  <%! %>  Example:- <%! public String name; public int age; public void setDetail(name,age); %>
  • 17. SCRIPTING ELEMENTS  Expression; this tag allows the developer to embed single java expression which is not terminated by a semi colon.  Syntax:-  <%= %>  Example:- <%= new java.util.Date() %>
  • 18. SCRIPTING ELEMENTS  Scriplets; this tag allows the developer to embedded java code inside it that can use the variable declared earlier.  Syntax:-  <% %>  Example:- <% int sum=a+b; system.out.println(sum); %>
  • 19. ACTION ELEMENT  Functions provided like:-  Use of java bean technology in jsp page.  Browser independent support for applet.  Transfers control among pages.  Syntax:-  <jsp: />
  • 20. ACTION ELEMENT  Standard action tag are:-  useBean  setProperty  getProperty  param  include  forward  plugin
  • 21. JSP IMPLICIT OBJECTS  There are certain objects in jsp that can be used in jsp page without being declared these are Implicit objects. There are nine implicit object in JSP:-  application  page  pageContext  config  session  exception  request  response  out
  • 22. EXAMPLE OF JSP  A simple jsp program to show date using scriplets;” teddyTest.jsp” <html> <head> </head> <body> <h1>JSP Page to show today Date </h1> <% out.println(new java.util.Date()); %> </body> </html>
  • 23. EXAMPLE OF JSP  Now we will use the implicit object to get values from a html page.  This is a html page to take user inputs “Impli.html” <html> <body> <form ACTION=“ImpliShow.jsp”> Name=<input type=“text” name=“nm”> <input type=“submit”> </form> </body> </html>
  • 24. EXAMPLE OF JSP  ImpliShow.jsp <html> <body> <% String nm=request.getParameter("usr"); String ag=request.getParameter("age"); out.println (“name:”+nm+””+age:”+ag); %> </body> </html>
  • 25. JAVA BEAN  Java bean is a self contained class file in java which typically contains;  No argument constructor.  Is seriliziable.  Have getter and setter methods to get and set values of the properties.  According to java white papers java beans are reusable component in java, and they combine various objects into a single one which can be accessed by multiple user.
  • 26. JAVA BEAN  Jsp use three action tag for use of java bean technology:-  useBean=used to locate or instantiate a bean class.  setProperty=set the property value or values of a bean class.  getProperty=get the property values of a bean class, first the property values are converted into string and then added to the request stream.
  • 27. JAVA BEAN  <jsp:useBean id= "instanceName" scope= "page | request | session | application" class= "packageName.className" type= "packageName.className“ beanName=“ packgeName.className | <%= expression >" > </jsp:useBean>
  • 28. JAVA BEAN  Example of useBean action tag in jsp:-  Class student{ private String name; Private int age; public void setName(string n){ name=n;} publci void setAge(int a){ age=n;} }
  • 29. JAVA BEAN  A html page named bean.html <html> <body> <form ACTION=“teddyBean.jsp”> Name=<input type=“text” name=“nm”> <input type=“submit”> </form> </body> </html>
  • 30. JAVA BEAN  A jsp page named teddyBean.jsp <html> <body> <jsp:useBean id=“obj” class=“student”> <% Sting n=request.getParameter(“name”); obj.setName(n); system.out.println(obj.getName()); %> </body> </html>
  • 31. JAVA BEAN  <jsp:setProperty name="instanceOfBean" property= "*" | property="propertyName" param="parameterName" | property="propertyName" value="{ string | <%= expression %>}" />  <jsp:getProperty name="instanceOfBean" property="propertyName" />
  • 32. JAVA BEAN  <jsp:setProperty name=“obj" property="name" value="*" />  To set all the values of the property.  <jsp:setProperty name=“obj” property=“_property” value=“_value” />  To set a particular property with a value.
  • 33. JAVA BEAN  Example of setProperty and getProperty action tag:- Package teddyPack public class jB { private String name; private int age; public void setAge(int age){this.age=age;} public void setName(String name){this.name=name;} public String getName(){return name;} public int getAge(){ return age;} }
  • 34. JAVA BEAN  A html page named “setGET.html” <html> <body> <form ACTION=“setGet.jsp”> Name:<input type=“text” name=“name”> Age:<input type=“text” name=“age”> <input type=“submit”> </form> </body></html>
  • 35. JAVA BEAN  A jsp page named “setGet.jsp” <html> <body> <jsp:useBean id="ted" class="teddyPack.jB" /> <% String n=request.getParameter("name");%> <jsp:setProperty name="ted" property="name" value="*" /> <b>HELLO</b><jsp:getProperty name="ted" property="name"/>; aged <jsp:getProperty name=“ted” property=“age”/> </body> </html>