SlideShare a Scribd company logo
1 of 20
JSP Application Models 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Review 
๏ฑ A JavaBean is a reusable software component that is manipulated in a 
builder tool. 
๏ฑ get() and set() methods are used with the property for which the data 
has to be set. 
๏ฑ The features of JavaBeans are methods, events, properties, 
introspection and serialization. 
๏ฑ JavaBeans have four scopes; page, request, session and application. 
๏ฑ JAR is a compressed file containing the Java classes. 
๏ฑ Every JavaBean is a Java class, but every Java class may not be a 
JavaBean. 
๏ฑ <jsp:useBean> tag is used for creating reference in any code. 
๏ฑ The Bean tag provides the page a means to encapsulate business logic 
separately from the content presentation. 
๏ฑ The key components of JavaMail APIs are session, message and 
transport. 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
JSP Application Models Overview 
๏ฑ Consists of Java code, HTML codes, and JSP 
tags 
๏ฑ Two approaches for building JSP 
applications are: 
๏‚ง Model 1 
๏‚ง Model 2 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Model 1 Architecture 
๏ฎ Represents a page-centric design 
๏ฎ Developed using scripting elements, custom tags, and a 
scripting language 
๏ฎ Client request is directly processed by JSP page 
๏ฎ JSP page accesses the database through JavaBeans to 
generate a response 
๏ฎ Model 1 applications are difficult to modify 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Model 2 Architecture 
๏ฑ Represents a controller design 
๏ฑ Suitable for large and complex applications 
๏ฑ Consists of a combination of servlets, JSP and JavaBeans 
๏ฑ Based on Model-View-Controller (MVC) pattern 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Model 2 Architecture (cont.) 
๏ฑ The MVC pattern includes: 
๏‚ง Model โ€“ Represents the application object or data that serves 
multiple views 
๏‚ง View โ€“ Represents the presentation component or the user 
interface component of the data model 
๏‚ง Controller โ€“ Responds to the input in the user interface. The 
controller transmits the request, and selects a view for presenting 
data to the user. 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Implementing Model 2 Architecture 
๏ฑ Requires controller servlet, request handler, page beans and JSP 
views 
๏ฑ Controller servlet handles the incoming request, and forwards to the 
request handler for further processing 
๏ฑ The handleRequest() method of the RequestHandler 
interface processes the request, and returns the URL of the JSP view 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
J2EE Framework 
๏ฑ Provides enterprise services, such as transactions and security 
๏ฑ Uses enterprise beans as a component 
๏ฑ Enables low and high level data communication, design pattern, and a 
component model that enables to build reusable components 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
J2EE Framework - Components 
๏ฎ Servlet โ€“ Consists of get() and post() methods, that are 
used for requesting data in dynamic Web applications 
๏ฎ Session bean โ€“ Consist of temporary objects that enable to 
distribute and isolate the processing task. The two forms of 
shared data are: 
๏‚ง Stateful 
๏‚ง Stateless 
๏ฎ Entity bean โ€“ Represents the data items, such as rows in a 
result set. The two forms of entity beans are: 
๏‚ง Container managed persistence 
๏‚ง Bean managed persistence 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
J2EE Framework โ€“ Components (cont.) 
๏ฎ Java terminologies โ€“ Includes terminologies, such as Java 
Naming and Directory Interface (JNDI), Enterprise JavaBeans 
(EJB), servlets, JavaServer Pages (JSP), Extensible Markup 
Language (XML) and Remote Method Invocation (RMI) that are 
used in Web applications 
๏ฎ Java Virtual Machine (JVM) โ€“ Provides a consistent execution 
platform for running Java codes 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
J2EE Framework - Benefits 
๏ฎ Common application model โ€“ Enables to create distributed, 
reliable, scalable and secure Web applications 
๏ฎ Generic infrastructure - Provides compatibility across vendors by 
introducing a standard Application Program Interface (API) 
๏ฎ Easy deployment and execution - Simplifies the task of deploying 
and running the Web application 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
RequestDispatcher Interface 
๏ฎ Forwards the request from a JSP page or a servlet to other resources 
๏ฎ Other resources process the request and send a response to the client 
๏ฎ The RequestDispatcher interface encapsulates the URL of a resource 
๏ฎ Two methods of RequestDispatcher interface are: 
๏‚ง Include() 
๏‚ง Forward() 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
RequestDispatcher Interface Methods 
Methods Syntax Description 
include() 
<jsp:include 
page="localURL" 
flush = "true") 
Invokes one JSP page or 
servlet from another 
forward() <jsp:forward 
page="Nextpage. 
jsp"/> 
Forwards a request from 
one JSP page or servlet to 
another 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Includes page from 
specified URL 
Additional request 
parameters 
Transfers control 
to specified URL 
Additional request 
parameters 
Using Methods - Code Snippets 
<jsp:include page="localURL" flush="true "> 
<jsp:param name="parameterName1" value="parameterValue1"/> 
//code 
<jsp:param name="parameterName1" value="parameterValue1"/> 
</jsp:include> 
Using Include () 
<jsp:forward page="localURL "> 
<jsp:param name="parameterName1" value="parameterValue1"/> 
//code 
<jsp:param name="parameterNameN" value="parameterValueN "/> 
</jsp:forward> 
Using Forward () 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Exception Handling 
๏‚ง Exceptions are errors that can occur in a JSP page 
๏‚ง The JSP page traps and handles request time errors 
๏‚ง Unhandled exceptions are forwarded to the error page 
๏‚ง Syntax 
<%@ page errorPage=โ€œerrorpage.jspโ€ %> 
๏‚ง Set the isErrorPage attribute of page directive to true, to 
make a JSP page an error handler 
๏‚ง Syntax 
<%@ page isErrorPage=โ€œtrueโ€ %> 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Exception Handling - Contโ€ฆ 
๏ฑ Translation time - Occurs when the JSP source file is converted to 
servlets class file. The JSP engine handles translation time errors. 
๏ฑ Request time - Occurs during the processing of the request. Request 
time errors are the runtime errors that throw exceptions. 
Makes JSP page an 
error handler 
Returns error 
message 
<html> 
<body> 
<%@ page isErrorPage="true" %> 
Detected Error: <br> 
<%= exception.getMessage() %> 
</body> 
</html> 
Code Snippet to create an error page 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Exception Handling - Contโ€ฆ 
<%@ page errorPage="errorpage.jsp" %> 
<% 
if (request.getParameter("param ").equals("value ")) 
{ 
// code 
} 
//The test above will throw a NullPointerException if param is 
// not part of the query string. A better implementation is: 
if ("value".equals(request.getParameter("param "))) 
{ 
// code 
} 
%> 
Forwards the unhandled 
exception to 
errorpage.jsp 
Code Snippet to transfer control to the 
error page 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Summary 
๏ฑ JSP technology enables the user to separate the presentation logic with the 
programming logic 
๏ฑ The user can make JSP page easy to read and maintain, by embedding 
HTML or XML in the JSP page 
๏ฑ Model 1 application is developed using scripting elements, custom tags, 
and a scripting language, such as JavaScript 
๏ฑ JSP page directly processes the request, and sends response to the client in 
Model 1 architecture 
๏ฑ The Model 2 applications are based on Model-View-Controller (MVC) 
pattern: 
๏‚ง Model 
๏‚ง View 
๏‚ง Controller 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Summary โ€“ Contโ€ฆ 
๏‚ง J2EE framework provides ready to use enterprise services, such as 
transactions and security 
๏ฑ The RequestDispatcher interface forwards the request from a JSP page or a 
servlet to other resources, such as HTML file, servlet, or a JSP page 
๏ฑ The two methods in RequesDispatcher interface are: 
๏‚ง include() 
๏‚ง forward() 
๏ฑ The unhandled exceptions are forwarded to the error handler file 
๏ฑ The errors in JSP page includes: 
๏‚ง Translation time 
๏‚ง Request time 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
Q & A 
ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3

More Related Content

What's hot

J2EE Architecture Explained
J2EE  Architecture ExplainedJ2EE  Architecture Explained
J2EE Architecture ExplainedAdarsh Kr Sinha
ย 
Types of Drivers in JDBC
Types of Drivers in JDBCTypes of Drivers in JDBC
Types of Drivers in JDBCHemant Sharma
ย 
J2ee seminar
J2ee seminarJ2ee seminar
J2ee seminarSahil Kukreja
ย 
Summer industrial trainingnew
Summer industrial trainingnewSummer industrial trainingnew
Summer industrial trainingnewVignesh Ramesh
ย 
Jsf+ejb 50
Jsf+ejb 50Jsf+ejb 50
Jsf+ejb 50lullabyte
ย 
Lab 5a) create a struts application
Lab 5a) create a struts applicationLab 5a) create a struts application
Lab 5a) create a struts applicationtechbed
ย 
Java ee introduction
Java ee introductionJava ee introduction
Java ee introductionMoumie Soulemane
ย 
IRJET- Training and Placement Database Management System
IRJET- Training and Placement Database Management SystemIRJET- Training and Placement Database Management System
IRJET- Training and Placement Database Management SystemIRJET Journal
ย 
Part 7 packaging and deployment
Part 7 packaging and deploymentPart 7 packaging and deployment
Part 7 packaging and deploymenttechbed
ย 
A dynamic application using jboss
A dynamic application using jbossA dynamic application using jboss
A dynamic application using jbossijcax
ย 
9. java server faces
9. java server faces9. java server faces
9. java server facesAnusAhmad
ย 

What's hot (19)

jdbc
jdbcjdbc
jdbc
ย 
J2EE Architecture Explained
J2EE  Architecture ExplainedJ2EE  Architecture Explained
J2EE Architecture Explained
ย 
Jdbc
JdbcJdbc
Jdbc
ย 
Spring Framework -I
Spring Framework -ISpring Framework -I
Spring Framework -I
ย 
Java J2EE
Java J2EEJava J2EE
Java J2EE
ย 
J2ee
J2eeJ2ee
J2ee
ย 
Types of Drivers in JDBC
Types of Drivers in JDBCTypes of Drivers in JDBC
Types of Drivers in JDBC
ย 
Hibernate I
Hibernate IHibernate I
Hibernate I
ย 
J2ee seminar
J2ee seminarJ2ee seminar
J2ee seminar
ย 
Summer industrial trainingnew
Summer industrial trainingnewSummer industrial trainingnew
Summer industrial trainingnew
ย 
J2EE Introduction
J2EE IntroductionJ2EE Introduction
J2EE Introduction
ย 
Jsf+ejb 50
Jsf+ejb 50Jsf+ejb 50
Jsf+ejb 50
ย 
JSP Technology I
JSP Technology IJSP Technology I
JSP Technology I
ย 
Lab 5a) create a struts application
Lab 5a) create a struts applicationLab 5a) create a struts application
Lab 5a) create a struts application
ย 
Java ee introduction
Java ee introductionJava ee introduction
Java ee introduction
ย 
IRJET- Training and Placement Database Management System
IRJET- Training and Placement Database Management SystemIRJET- Training and Placement Database Management System
IRJET- Training and Placement Database Management System
ย 
Part 7 packaging and deployment
Part 7 packaging and deploymentPart 7 packaging and deployment
Part 7 packaging and deployment
ย 
A dynamic application using jboss
A dynamic application using jbossA dynamic application using jboss
A dynamic application using jboss
ย 
9. java server faces
9. java server faces9. java server faces
9. java server faces
ย 

Similar to 1.jsp application models

3.java database connectivity
3.java database connectivity3.java database connectivity
3.java database connectivityweb360
ย 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
ย 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET Journal
ย 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET PresentationRasel Khan
ย 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
ย 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
ย 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892Tuna Tore
ย 
Jsf2 overview
Jsf2 overviewJsf2 overview
Jsf2 overviewsohan1234
ย 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my wayNicola Pedot
ย 
Month 2 report
Month 2 reportMonth 2 report
Month 2 reportPRIYANKA FNU
ย 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
ย 
Struts natraj - satya
Struts   natraj - satyaStruts   natraj - satya
Struts natraj - satyaSatya Johnny
ย 
Struts notes
Struts notesStruts notes
Struts notesdssreenath
ย 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overviewskill-guru
ย 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMAashish Jain
ย 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
ย 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practicesejjavies
ย 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsBG Java EE Course
ย 

Similar to 1.jsp application models (20)

3.java database connectivity
3.java database connectivity3.java database connectivity
3.java database connectivity
ย 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
ย 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
ย 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
ย 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
ย 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
ย 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
ย 
Jsf2 overview
Jsf2 overviewJsf2 overview
Jsf2 overview
ย 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
ย 
Month 2 report
Month 2 reportMonth 2 report
Month 2 report
ย 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
ย 
Struts natraj - satya
Struts   natraj - satyaStruts   natraj - satya
Struts natraj - satya
ย 
Struts natraj - satya
Struts   natraj - satyaStruts   natraj - satya
Struts natraj - satya
ย 
Struts notes
Struts notesStruts notes
Struts notes
ย 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
ย 
Mvc15 (1)
Mvc15 (1)Mvc15 (1)
Mvc15 (1)
ย 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
ย 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
ย 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practices
ย 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
ย 

Recently uploaded

CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธanilsa9823
ย 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
ย 
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Steffen Staab
ย 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
ย 
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female serviceCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
ย 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfWilly Marroquin (WillyDevNET)
ย 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
ย 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
ย 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
ย 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
ย 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto Gonzรกlez Trastoy
ย 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
ย 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
ย 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
ย 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
ย 
CHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
ย 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
ย 
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธDelhi Call girls
ย 

Recently uploaded (20)

CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online  โ˜‚๏ธ
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Kakori Lucknow best sexual service Online โ˜‚๏ธ
ย 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
ย 
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
ย 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
ย 
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female serviceCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
ย 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
ย 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
ย 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
ย 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
ย 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
ย 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
ย 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
ย 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
ย 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
ย 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
ย 
Vip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS LiveVip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida โžก๏ธ Delhi โžก๏ธ 9999965857 No Advance 24HRS Live
ย 
CHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
ย 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
ย 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
ย 
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
ย 

1.jsp application models

  • 1. JSP Application Models ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 2. Review ๏ฑ A JavaBean is a reusable software component that is manipulated in a builder tool. ๏ฑ get() and set() methods are used with the property for which the data has to be set. ๏ฑ The features of JavaBeans are methods, events, properties, introspection and serialization. ๏ฑ JavaBeans have four scopes; page, request, session and application. ๏ฑ JAR is a compressed file containing the Java classes. ๏ฑ Every JavaBean is a Java class, but every Java class may not be a JavaBean. ๏ฑ <jsp:useBean> tag is used for creating reference in any code. ๏ฑ The Bean tag provides the page a means to encapsulate business logic separately from the content presentation. ๏ฑ The key components of JavaMail APIs are session, message and transport. ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 3. JSP Application Models Overview ๏ฑ Consists of Java code, HTML codes, and JSP tags ๏ฑ Two approaches for building JSP applications are: ๏‚ง Model 1 ๏‚ง Model 2 ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 4. Model 1 Architecture ๏ฎ Represents a page-centric design ๏ฎ Developed using scripting elements, custom tags, and a scripting language ๏ฎ Client request is directly processed by JSP page ๏ฎ JSP page accesses the database through JavaBeans to generate a response ๏ฎ Model 1 applications are difficult to modify ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 5. Model 2 Architecture ๏ฑ Represents a controller design ๏ฑ Suitable for large and complex applications ๏ฑ Consists of a combination of servlets, JSP and JavaBeans ๏ฑ Based on Model-View-Controller (MVC) pattern ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 6. Model 2 Architecture (cont.) ๏ฑ The MVC pattern includes: ๏‚ง Model โ€“ Represents the application object or data that serves multiple views ๏‚ง View โ€“ Represents the presentation component or the user interface component of the data model ๏‚ง Controller โ€“ Responds to the input in the user interface. The controller transmits the request, and selects a view for presenting data to the user. ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 7. Implementing Model 2 Architecture ๏ฑ Requires controller servlet, request handler, page beans and JSP views ๏ฑ Controller servlet handles the incoming request, and forwards to the request handler for further processing ๏ฑ The handleRequest() method of the RequestHandler interface processes the request, and returns the URL of the JSP view ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 8. J2EE Framework ๏ฑ Provides enterprise services, such as transactions and security ๏ฑ Uses enterprise beans as a component ๏ฑ Enables low and high level data communication, design pattern, and a component model that enables to build reusable components ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 9. J2EE Framework - Components ๏ฎ Servlet โ€“ Consists of get() and post() methods, that are used for requesting data in dynamic Web applications ๏ฎ Session bean โ€“ Consist of temporary objects that enable to distribute and isolate the processing task. The two forms of shared data are: ๏‚ง Stateful ๏‚ง Stateless ๏ฎ Entity bean โ€“ Represents the data items, such as rows in a result set. The two forms of entity beans are: ๏‚ง Container managed persistence ๏‚ง Bean managed persistence ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 10. J2EE Framework โ€“ Components (cont.) ๏ฎ Java terminologies โ€“ Includes terminologies, such as Java Naming and Directory Interface (JNDI), Enterprise JavaBeans (EJB), servlets, JavaServer Pages (JSP), Extensible Markup Language (XML) and Remote Method Invocation (RMI) that are used in Web applications ๏ฎ Java Virtual Machine (JVM) โ€“ Provides a consistent execution platform for running Java codes ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 11. J2EE Framework - Benefits ๏ฎ Common application model โ€“ Enables to create distributed, reliable, scalable and secure Web applications ๏ฎ Generic infrastructure - Provides compatibility across vendors by introducing a standard Application Program Interface (API) ๏ฎ Easy deployment and execution - Simplifies the task of deploying and running the Web application ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 12. RequestDispatcher Interface ๏ฎ Forwards the request from a JSP page or a servlet to other resources ๏ฎ Other resources process the request and send a response to the client ๏ฎ The RequestDispatcher interface encapsulates the URL of a resource ๏ฎ Two methods of RequestDispatcher interface are: ๏‚ง Include() ๏‚ง Forward() ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 13. RequestDispatcher Interface Methods Methods Syntax Description include() <jsp:include page="localURL" flush = "true") Invokes one JSP page or servlet from another forward() <jsp:forward page="Nextpage. jsp"/> Forwards a request from one JSP page or servlet to another ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 14. Includes page from specified URL Additional request parameters Transfers control to specified URL Additional request parameters Using Methods - Code Snippets <jsp:include page="localURL" flush="true "> <jsp:param name="parameterName1" value="parameterValue1"/> //code <jsp:param name="parameterName1" value="parameterValue1"/> </jsp:include> Using Include () <jsp:forward page="localURL "> <jsp:param name="parameterName1" value="parameterValue1"/> //code <jsp:param name="parameterNameN" value="parameterValueN "/> </jsp:forward> Using Forward () ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 15. Exception Handling ๏‚ง Exceptions are errors that can occur in a JSP page ๏‚ง The JSP page traps and handles request time errors ๏‚ง Unhandled exceptions are forwarded to the error page ๏‚ง Syntax <%@ page errorPage=โ€œerrorpage.jspโ€ %> ๏‚ง Set the isErrorPage attribute of page directive to true, to make a JSP page an error handler ๏‚ง Syntax <%@ page isErrorPage=โ€œtrueโ€ %> ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 16. Exception Handling - Contโ€ฆ ๏ฑ Translation time - Occurs when the JSP source file is converted to servlets class file. The JSP engine handles translation time errors. ๏ฑ Request time - Occurs during the processing of the request. Request time errors are the runtime errors that throw exceptions. Makes JSP page an error handler Returns error message <html> <body> <%@ page isErrorPage="true" %> Detected Error: <br> <%= exception.getMessage() %> </body> </html> Code Snippet to create an error page ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 17. Exception Handling - Contโ€ฆ <%@ page errorPage="errorpage.jsp" %> <% if (request.getParameter("param ").equals("value ")) { // code } //The test above will throw a NullPointerException if param is // not part of the query string. A better implementation is: if ("value".equals(request.getParameter("param "))) { // code } %> Forwards the unhandled exception to errorpage.jsp Code Snippet to transfer control to the error page ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 18. Summary ๏ฑ JSP technology enables the user to separate the presentation logic with the programming logic ๏ฑ The user can make JSP page easy to read and maintain, by embedding HTML or XML in the JSP page ๏ฑ Model 1 application is developed using scripting elements, custom tags, and a scripting language, such as JavaScript ๏ฑ JSP page directly processes the request, and sends response to the client in Model 1 architecture ๏ฑ The Model 2 applications are based on Model-View-Controller (MVC) pattern: ๏‚ง Model ๏‚ง View ๏‚ง Controller ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 19. Summary โ€“ Contโ€ฆ ๏‚ง J2EE framework provides ready to use enterprise services, such as transactions and security ๏ฑ The RequestDispatcher interface forwards the request from a JSP page or a servlet to other resources, such as HTML file, servlet, or a JSP page ๏ฑ The two methods in RequesDispatcher interface are: ๏‚ง include() ๏‚ง forward() ๏ฑ The unhandled exceptions are forwarded to the error handler file ๏ฑ The errors in JSP page includes: ๏‚ง Translation time ๏‚ง Request time ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3
  • 20. Q & A ยฉFPT SOFTWARE โ€“ TRAINING MATERIAL โ€“ Internal use 04e-BM/NS/HDCV/FSOFT v2/3