© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.

Slides:



Advertisements
Similar presentations
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Advertisements

3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
Apache Struts Technology
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
An architecture for webb applications, J2EE
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
Sapana Mehta (CS-6V81) Overview Of J2EE & JBoss Sapana Mehta.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
Layers & Tiers Umair Javed Lec - 41.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
J2EE Java2 Enterprise Edition by Damian Borth. Contents Introduction Architectures styles Components Scenarios Roles Processing a HTTP request.
J2EE Java 2 Enterprise Edition. Relevant Topics in The Java Tutorial Topic Web Page JDBC orial/jdbc
Enterprise Programming By J Pearce. Enterprise Software Sales HR Inventory Customer Support Shipping.
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
CS 483 Enterprise and Web Application Programming
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 37 - JavaServer Pages (JSP): Bonus for Java Developers Outline 37.1 Introduction 37.2 JavaServer.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
Introduction to J2EE Architecture Portions by Kunal Mehta.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Case Study + MVC Lec Error Pages By means of the page directive, a JSP can be given the responsibility of an Error page An Error JSP will be called.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
1 Java EE Programming Enterprise JavaBeans. 2 Topics J2EE Overview Enterprise JavaBeans Overview Enterprise Entity Beans Case Study How to build them.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
CSC 2720 Building Web Applications Frameworks for Building Web Applications.
Enterprise Java Beans. Model 1 J2EE – Web View Model/View/Controller Model View Control Data base Web Server Model One Architecture HTTP Request HTTP.
Java Servlets and Java Server Pages Norman White Stern School of Business.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
Page 1 R MVC Design Pattern Definition Properties Describing MVC design patterns.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Apache Struts Technology A MVC Framework for Java Web Applications.
J2EE Platform Overview (Application Architecture)
Plateform for Enterprise Solution: Java EE5
Introduction to J2EE Architecture
Knowledge Byte In this section, you will learn about:
MSIS 655 Advanced Business Applications Programming
Distributed System Using Java 2 Enterprise Edition (J2EE)
JavaServer Faces: The Fundamentals
Enterprise Java Beans.
Knowledge Byte In this section, you will learn about:
Presentation transcript:

© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 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.  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  Consists of Java code, HTML codes, and JSP tags  Two approaches for building JSP applications are:  Model 1  Model 2 JSP Application Models Overview

© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 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 Model 1 Architecture

© 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  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. Model 2 Architecture (cont.)

© 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 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 J2EE Framework – Components (cont.)

© 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 MethodsSyntaxDescription include() <jsp:include page="localURL" flush = "true") Invokes one JSP page or servlet from another forward() Forwards a request from one JSP page or servlet to another RequestDispatcher Interface Methods

© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Additional request parameters Using Methods - Code Snippets //code //code Includes page from specified URL Transfers control to specified URL Using Include () 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  Set the isErrorPage attribute of page directive to true, to make a JSP page an error handler  Syntax

© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Exception Handling - Cont… Makes JSP page an error handler Returns error message Detected Error:  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. Code Snippet to create an error page

© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Exception Handling - Cont… <% 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