SlideShare a Scribd company logo
PROGRAMMING IN ADVANCE JAVA
(J2EE)
Created By : Vikas Goyal
Basic Concepts Of Advance Java
 JVM : Java Virtual Machine
 Assertion
 JDBC : Java Database Connectivity
 Java Servlet
 JSP : Java Server Pages
Created By : Vikas Goyal
JVM : Java Virtual Machine
 Java application are typically compiled to byte code
(class file) that can run on any java virtual machine
(JVM) regardless of computer architecture.
 Before understanding what is JVM let us first know
what virtual machine is.
 A Virtual Machine is a layer of abstraction that gives
a program one simplified interface for interacting
with a variety of physical computers and their
operation system.
Created By : Vikas Goyal
JVM : Java Virtual Machine
 As the name indicates, JVM is not a real hardware
machine but a software layer which resembles an
hardware platform.
 JVM converts java byte code into machine language
and execute it.
 The byte code can be executed on any platform
where there exists JVM
Created By : Vikas Goyal
Diagram for JVM
Created By : Vikas Goyal
Components of JVM
 Byte code verifier : It checks for unusual code.
 Class loader : It loads the java class into JVM. It also reads
byte code and creates the instance of java.lang.class
 Execution engine : It helps JVM to convert byte code into
machine code.
 Garbage collector : It is the process of automatically freeing
objects that are no longer referenced by the program.
 Security manager : It constantly monitors the code.
Created By : Vikas Goyal
Assertion
 An assertion is a statement in Java that enables you to
test your assumptions about your program.
 Each assertion contains a boolean expression that you
believe will be true when the assertion executes.
 By verifying that the boolean expression is indeed true,
the assertion confirms your assumptions about the
behavior of your program, increasing your confidence
that the program is free of errors.
Created By : Vikas Goyal
Why use assertions?
 Programming by contract
 Pre-conditions
 Assert precondition as requirement of client
 Post-conditions
 Assert post-condition as effect of client method
Created By : Vikas Goyal
Syntax of using Assertion :
 There are two ways to use assertion.
 First way is : assert expression;
 Second way is : assert expression1 : expression2;
Created By : Vikas Goyal
Simple Example of Assertion in Advance Java
Created By : Vikas Goyal
JDBC : Java Database Connectivity
 JDBC provides Java applications with access to most
database systems via SQL.
 Before APIs like JDBC and ODBC, database
connectivity was tedious
With JDBC, the application programmer uses the
JDBC API
The developer never uses any proprietary APIs
• Any proprietary APIs are implemented by a JDBC
driver
• There are 4 types of JDBC Drivers
Created By : Vikas Goyal
JDBC : Java Database Connectivity
Type 1 - JDBC-ODBC Bridge
Type 2 - JDBC-Native Bridge
Type 3 - JDBC-Net Bridge
Type 4 - Direct JDBC Driver
Type 1 only runs on platforms where ODBC is available
ODBC must be configured separately
Type 2 Drivers map between a proprietary Database API and
the JDBC API
Type 3 Drivers are used with middleware products
Type 4 Drivers are written in Java
In most cases, type 4 drivers are preferred
Created By : Vikas Goyal
JDBC : Java Database Connectivity
Created By : Vikas Goyal
JDBC : Java Database Connectivity
Created By : Vikas Goyal
JDBC : Java Database Connectivity
Created By : Vikas Goyal
Java Servlet
16
 Servlets are the Java technology for serving HTTP
requests.
 They are particularly used for serving HTTP requests, but
they can be used as a basis for serving other requests,
too.
 Basic servlet functionalities implemented by the basic
HTTP servlet classes have the features for accessing
HTTP request data and managing cookies and sessions.
 Typically some other technology is used for user interface
or representation part.
 Basic servlets are not that handy for representation matters.
Created By : Vikas Goyal
Important To Know
17
 javax.servlet.Servlet
 Interface defining methods that all servlets implement
 javax.servlet.GenericServlet
 An abstract class for all Servlets
 javax.servlet.HttpServlet
 An abstract class for servlets serving HTTP requests.
 Most importantly, a Http servlet needs to implement the
doPost() and doGet() methods, which are called when a post or
get request is received.
 This is the basis for getting started with the implementation
http servlets.
Created By : Vikas Goyal
Java Servlet Web Application
18
 Servlet development (learning) life cycle
 Development
 Defining servlet classes, methods and properties
 Deployment
 Servlet mapping to web environment
 (Deployment on Tomcat)
 Execution
 Understand its execution life cycle
Created By : Vikas Goyal
“web.xml” Configuration
19
 Using the file
“web.xml” for more
specific mapping
 The file is in the
“WEB-INF” folder
 Example
 Servlet class
 HelloWorld.class
 Application context:
 http://localhost:8988/servletintro/
 Invoker class mapping
 http://localhost:8988/servletintro/servlet/HelloWorld
 Specific mapping
 http://localhost:8988/servletintro/hello
 For more mapping examples, see example “web.xml”
<servlet>
<servlet-name>HelloW</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloW</servlet-name>
<url-pattern>hello</url-pattern>
</servlet-mapping>
Created By : Vikas Goyal
Servlet Example
Created By : Vikas Goyal
JSP : Java Server Pages
 Four different elements are used in constructing JSPs
 Scripting Elements
 Implicit Objects
 Directives
 Actions
 JSPs run in two phases
 Translation Phase
 Execution Phase
 In translation phase JSP page is compiled into a servlet
 called JSP Page Implementation class
 In execution phase the compiled JSP is processed
Created By : Vikas Goyal
JSP : Java Server Pages
Created By : Vikas Goyal
JSP : Java Server Pages
 JSP Actions :
 Processed during the request processing phase.
 As opposed to JSP directives which are processed during translation
 Standard actions should be supported by J2EE compliant web servers
 Custom actions can be created using tag libraries
 The different actions are
 Include action : <jsp:include page=“inlcudedPage.jsp”>
 Forward action : <jsp:forward page=“Forwarded.html”>
Param action : <jsp:forward page=“Param2.jsp”>
<jsp:param name=“FirstName” value=“Sanjay”>
</jsp:forward>
Created By : Vikas Goyal
JSP : Java Server Pages
o useBean action : <jsp:useBean id=“myName” scope=“request”
class=“java.lang.String”>
<% firstName=“Sanjay”; %>
</jsp:useBean>
 setProperty action:<jsp:setProperty name=“myBean” property=“firstName”
value=“Sanjay”/>
 getProperty action:<jsp:getProperty name=“myBean” property=“firstName” />

Created By : Vikas Goyal
JSP : Java Server Pages
o plugIn action:
<jsp: plugin type=“applet” code=“MyApplet.class” codebase=“/”>
<jsp:params>
<jsp:param name=“myParam” value=“122”/>
</jsp:params>
<jsp:fallback><b>Unable to loadapplet</b></jsp:fallback>
</jsp:plugin>
Created By : Vikas Goyal
Ad

More Related Content

What's hot (20)

Spring framework core
Spring framework coreSpring framework core
Spring framework core
Taemon Piya-Lumyong
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
mahir jain
 
Spring Boot
Spring BootSpring Boot
Spring Boot
koppenolski
 
Core Java
Core JavaCore Java
Core Java
Priyanka Pradhan
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
Information Technology
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
Return on Intelligence
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
Santosh Kumar Kar
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
Roman Savitskiy
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
Dzmitry Naskou
 
Struts
StrutsStruts
Struts
s4al_com
 
QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
guest11106b
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
Vadym Lotar
 
Une (simple) présentation de Apache Maven 2
Une (simple) présentation de Apache Maven 2Une (simple) présentation de Apache Maven 2
Une (simple) présentation de Apache Maven 2
teejug
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Selenium
SeleniumSelenium
Selenium
conect2krish
 
Core java
Core javaCore java
Core java
Shivaraj R
 
50 nouvelles choses que l'on peut faire avec Java 8
50 nouvelles choses que l'on peut faire avec Java 850 nouvelles choses que l'on peut faire avec Java 8
50 nouvelles choses que l'on peut faire avec Java 8
José Paumard
 

Viewers also liked (20)

advanced java programming(java programming tutorials)
 advanced java programming(java programming tutorials) advanced java programming(java programming tutorials)
advanced java programming(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Advanced java
Advanced java Advanced java
Advanced java
NA
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
Arun Gupta
 
Wire mesh glass types
Wire mesh glass typesWire mesh glass types
Wire mesh glass types
Andrea J.
 
Why do some patents get licensed while others do not?
Why do some patents get licensed while others do not?Why do some patents get licensed while others do not?
Why do some patents get licensed while others do not?
Ian McCarthy
 
Amid sahyoun cv(updated 2016)
Amid sahyoun cv(updated 2016)Amid sahyoun cv(updated 2016)
Amid sahyoun cv(updated 2016)
Amid Sahyoun; PMP, PE
 
Define operationally final
Define operationally finalDefine operationally final
Define operationally final
majumalon
 
神召神學院畢業證書
神召神學院畢業證書神召神學院畢業證書
神召神學院畢業證書
Man Hon Lo
 
7336 16
7336 167336 16
7336 16
Tel-Aviv Journalists' Association
 
Final Paper
Final PaperFinal Paper
Final Paper
Lindsay Crouse
 
בגץ התאגיד.Pdf
בגץ התאגיד.Pdfבגץ התאגיד.Pdf
בגץ התאגיד.Pdf
Tel-Aviv Journalists' Association
 
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVAE-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
Sudhanshu kumar Sah
 
קורות חיים מירב
קורות חיים מירבקורות חיים מירב
קורות חיים מירב
Meirav Mor
 
Design Thinking: Interpretation
Design Thinking: InterpretationDesign Thinking: Interpretation
Design Thinking: Interpretation
Itamar Medeiros
 
Advanced Java I
Advanced Java IAdvanced Java I
Advanced Java I
Jay Xu
 
קורות חיים - רוח ערן קליין
קורות חיים - רוח ערן קליין קורות חיים - רוח ערן קליין
קורות חיים - רוח ערן קליין
eran klein
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
AVINASH KUMAR
 
OB (Emotions and Attitudes)
OB (Emotions and Attitudes)OB (Emotions and Attitudes)
OB (Emotions and Attitudes)
- Freelance
 
Advanced java
Advanced java Advanced java
Advanced java
NA
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
Arun Gupta
 
Wire mesh glass types
Wire mesh glass typesWire mesh glass types
Wire mesh glass types
Andrea J.
 
Why do some patents get licensed while others do not?
Why do some patents get licensed while others do not?Why do some patents get licensed while others do not?
Why do some patents get licensed while others do not?
Ian McCarthy
 
Define operationally final
Define operationally finalDefine operationally final
Define operationally final
majumalon
 
神召神學院畢業證書
神召神學院畢業證書神召神學院畢業證書
神召神學院畢業證書
Man Hon Lo
 
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVAE-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
Sudhanshu kumar Sah
 
קורות חיים מירב
קורות חיים מירבקורות חיים מירב
קורות חיים מירב
Meirav Mor
 
Design Thinking: Interpretation
Design Thinking: InterpretationDesign Thinking: Interpretation
Design Thinking: Interpretation
Itamar Medeiros
 
Advanced Java I
Advanced Java IAdvanced Java I
Advanced Java I
Jay Xu
 
קורות חיים - רוח ערן קליין
קורות חיים - רוח ערן קליין קורות חיים - רוח ערן קליין
קורות חיים - רוח ערן קליין
eran klein
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
AVINASH KUMAR
 
OB (Emotions and Attitudes)
OB (Emotions and Attitudes)OB (Emotions and Attitudes)
OB (Emotions and Attitudes)
- Freelance
 
Ad

Similar to Project Presentation on Advance Java (20)

Jdbc
JdbcJdbc
Jdbc
BindhuBhargaviTalasi
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
hchen1
 
Enterprise Java, Servlet, JDBC and JSP.pdf
Enterprise Java, Servlet, JDBC and JSP.pdfEnterprise Java, Servlet, JDBC and JSP.pdf
Enterprise Java, Servlet, JDBC and JSP.pdf
PokemonSpyk
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
SachinSingh217687
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
backdoor
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
praveen_guda
 
Web sphere liberty2
Web sphere liberty2Web sphere liberty2
Web sphere liberty2
JyothirmaiG4
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
ADEEBANADEEM
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
Jafar Nesargi
 
Chapter2 j2ee
Chapter2 j2eeChapter2 j2ee
Chapter2 j2ee
Jafar Nesargi
 
Servlets
ServletsServlets
Servlets
ZainabNoorGul
 
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
NicheTech Com. Solutions Pvt. Ltd.
 
Ecom 1
Ecom 1Ecom 1
Ecom 1
Santosh Pandey
 
P20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptxP20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptx
DrTCVijayaraghavan
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
Minal Maniar
 
4. J2EE.pptx
4. J2EE.pptx4. J2EE.pptx
4. J2EE.pptx
HariChandruduM
 
Comman Gateway interface Java cgi pro.pptx
Comman Gateway interface Java cgi pro.pptxComman Gateway interface Java cgi pro.pptx
Comman Gateway interface Java cgi pro.pptx
JebastinRaj1
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
Arumugam90
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
Arumugam90
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
hchen1
 
Enterprise Java, Servlet, JDBC and JSP.pdf
Enterprise Java, Servlet, JDBC and JSP.pdfEnterprise Java, Servlet, JDBC and JSP.pdf
Enterprise Java, Servlet, JDBC and JSP.pdf
PokemonSpyk
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
backdoor
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
praveen_guda
 
Web sphere liberty2
Web sphere liberty2Web sphere liberty2
Web sphere liberty2
JyothirmaiG4
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
ADEEBANADEEM
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
Jafar Nesargi
 
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
NicheTech Com. Solutions Pvt. Ltd.
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
Minal Maniar
 
Comman Gateway interface Java cgi pro.pptx
Comman Gateway interface Java cgi pro.pptxComman Gateway interface Java cgi pro.pptx
Comman Gateway interface Java cgi pro.pptx
JebastinRaj1
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
Arumugam90
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
Arumugam90
 
Ad

Project Presentation on Advance Java

  • 1. PROGRAMMING IN ADVANCE JAVA (J2EE) Created By : Vikas Goyal
  • 2. Basic Concepts Of Advance Java  JVM : Java Virtual Machine  Assertion  JDBC : Java Database Connectivity  Java Servlet  JSP : Java Server Pages Created By : Vikas Goyal
  • 3. JVM : Java Virtual Machine  Java application are typically compiled to byte code (class file) that can run on any java virtual machine (JVM) regardless of computer architecture.  Before understanding what is JVM let us first know what virtual machine is.  A Virtual Machine is a layer of abstraction that gives a program one simplified interface for interacting with a variety of physical computers and their operation system. Created By : Vikas Goyal
  • 4. JVM : Java Virtual Machine  As the name indicates, JVM is not a real hardware machine but a software layer which resembles an hardware platform.  JVM converts java byte code into machine language and execute it.  The byte code can be executed on any platform where there exists JVM Created By : Vikas Goyal
  • 5. Diagram for JVM Created By : Vikas Goyal
  • 6. Components of JVM  Byte code verifier : It checks for unusual code.  Class loader : It loads the java class into JVM. It also reads byte code and creates the instance of java.lang.class  Execution engine : It helps JVM to convert byte code into machine code.  Garbage collector : It is the process of automatically freeing objects that are no longer referenced by the program.  Security manager : It constantly monitors the code. Created By : Vikas Goyal
  • 7. Assertion  An assertion is a statement in Java that enables you to test your assumptions about your program.  Each assertion contains a boolean expression that you believe will be true when the assertion executes.  By verifying that the boolean expression is indeed true, the assertion confirms your assumptions about the behavior of your program, increasing your confidence that the program is free of errors. Created By : Vikas Goyal
  • 8. Why use assertions?  Programming by contract  Pre-conditions  Assert precondition as requirement of client  Post-conditions  Assert post-condition as effect of client method Created By : Vikas Goyal
  • 9. Syntax of using Assertion :  There are two ways to use assertion.  First way is : assert expression;  Second way is : assert expression1 : expression2; Created By : Vikas Goyal
  • 10. Simple Example of Assertion in Advance Java Created By : Vikas Goyal
  • 11. JDBC : Java Database Connectivity  JDBC provides Java applications with access to most database systems via SQL.  Before APIs like JDBC and ODBC, database connectivity was tedious With JDBC, the application programmer uses the JDBC API The developer never uses any proprietary APIs • Any proprietary APIs are implemented by a JDBC driver • There are 4 types of JDBC Drivers Created By : Vikas Goyal
  • 12. JDBC : Java Database Connectivity Type 1 - JDBC-ODBC Bridge Type 2 - JDBC-Native Bridge Type 3 - JDBC-Net Bridge Type 4 - Direct JDBC Driver Type 1 only runs on platforms where ODBC is available ODBC must be configured separately Type 2 Drivers map between a proprietary Database API and the JDBC API Type 3 Drivers are used with middleware products Type 4 Drivers are written in Java In most cases, type 4 drivers are preferred Created By : Vikas Goyal
  • 13. JDBC : Java Database Connectivity Created By : Vikas Goyal
  • 14. JDBC : Java Database Connectivity Created By : Vikas Goyal
  • 15. JDBC : Java Database Connectivity Created By : Vikas Goyal
  • 16. Java Servlet 16  Servlets are the Java technology for serving HTTP requests.  They are particularly used for serving HTTP requests, but they can be used as a basis for serving other requests, too.  Basic servlet functionalities implemented by the basic HTTP servlet classes have the features for accessing HTTP request data and managing cookies and sessions.  Typically some other technology is used for user interface or representation part.  Basic servlets are not that handy for representation matters. Created By : Vikas Goyal
  • 17. Important To Know 17  javax.servlet.Servlet  Interface defining methods that all servlets implement  javax.servlet.GenericServlet  An abstract class for all Servlets  javax.servlet.HttpServlet  An abstract class for servlets serving HTTP requests.  Most importantly, a Http servlet needs to implement the doPost() and doGet() methods, which are called when a post or get request is received.  This is the basis for getting started with the implementation http servlets. Created By : Vikas Goyal
  • 18. Java Servlet Web Application 18  Servlet development (learning) life cycle  Development  Defining servlet classes, methods and properties  Deployment  Servlet mapping to web environment  (Deployment on Tomcat)  Execution  Understand its execution life cycle Created By : Vikas Goyal
  • 19. “web.xml” Configuration 19  Using the file “web.xml” for more specific mapping  The file is in the “WEB-INF” folder  Example  Servlet class  HelloWorld.class  Application context:  http://localhost:8988/servletintro/  Invoker class mapping  http://localhost:8988/servletintro/servlet/HelloWorld  Specific mapping  http://localhost:8988/servletintro/hello  For more mapping examples, see example “web.xml” <servlet> <servlet-name>HelloW</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloW</servlet-name> <url-pattern>hello</url-pattern> </servlet-mapping> Created By : Vikas Goyal
  • 20. Servlet Example Created By : Vikas Goyal
  • 21. JSP : Java Server Pages  Four different elements are used in constructing JSPs  Scripting Elements  Implicit Objects  Directives  Actions  JSPs run in two phases  Translation Phase  Execution Phase  In translation phase JSP page is compiled into a servlet  called JSP Page Implementation class  In execution phase the compiled JSP is processed Created By : Vikas Goyal
  • 22. JSP : Java Server Pages Created By : Vikas Goyal
  • 23. JSP : Java Server Pages  JSP Actions :  Processed during the request processing phase.  As opposed to JSP directives which are processed during translation  Standard actions should be supported by J2EE compliant web servers  Custom actions can be created using tag libraries  The different actions are  Include action : <jsp:include page=“inlcudedPage.jsp”>  Forward action : <jsp:forward page=“Forwarded.html”> Param action : <jsp:forward page=“Param2.jsp”> <jsp:param name=“FirstName” value=“Sanjay”> </jsp:forward> Created By : Vikas Goyal
  • 24. JSP : Java Server Pages o useBean action : <jsp:useBean id=“myName” scope=“request” class=“java.lang.String”> <% firstName=“Sanjay”; %> </jsp:useBean>  setProperty action:<jsp:setProperty name=“myBean” property=“firstName” value=“Sanjay”/>  getProperty action:<jsp:getProperty name=“myBean” property=“firstName” />  Created By : Vikas Goyal
  • 25. JSP : Java Server Pages o plugIn action: <jsp: plugin type=“applet” code=“MyApplet.class” codebase=“/”> <jsp:params> <jsp:param name=“myParam” value=“122”/> </jsp:params> <jsp:fallback><b>Unable to loadapplet</b></jsp:fallback> </jsp:plugin> Created By : Vikas Goyal