SSC - Web development Model-View-Controller for Java Servlet

Similar documents
SSC - Web applications and development Introduction and Java Servlet (I)

Ch04 JavaServer Pages (JSP)

Experiment No: Group B_2

Developing Applications with Java EE 6 on WebLogic Server 12c

Web Presentation Patterns (controller) SWEN-343 From Fowler, Patterns of Enterprise Application Architecture

Advantage of JSP over Servlet

UNIT -5. Java Server Page

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

One application has servlet context(s).

Introduction to Java Server Pages. Enabling Technologies - Plug-ins Scripted Pages

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming

Distributed Multitiered Application

Development of E-Institute Management System Based on Integrated SSH Framework

Java Enterprise Edition

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Unit 5 JSP (Java Server Pages)

Spring & Hibernate. Knowledge of database. And basic Knowledge of web application development. Module 1: Spring Basics

directive attribute1= value1 attribute2= value2... attributen= valuen %>

Java Server Page (JSP)

Exercise. (1) Which of the following can not be used as the scope when using a JavaBean with JSP? a. application b. session c. request d.

112. Introduction to JSP

Remote Health Service System based on Struts2 and Hibernate

Internet Technologies. Lab Introduction

Oracle Fusion Middleware 11g: Build Applications with ADF I

ADVANCED JAVA COURSE CURRICULUM

Call: JSP Spring Hibernate Webservice Course Content:35-40hours Course Outline

112-WL. Introduction to JSP with WebLogic

FILE - JAVA WEB SERVICE TUTORIAL

2005, Cornell University

Oracle Forms Modernization Through Automated Migration. A Technical Overview

Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat

JavaEE Interview Prep

Implementing a Numerical Data Access Service

SPRING MOCK TEST SPRING MOCK TEST I

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

JSP MOCK TEST JSP MOCK TEST III

Java SE7 Fundamentals

Call: Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline

(p t y) lt d. 1995/04149/07. Course List 2018

Oracle Fusion Middleware 11g: Build Applications with ADF I

Fast Track to Java EE

The project is conducted individually The objective is to develop your dynamic, database supported, web site:

Sitesbay.com. A Perfect Place for All Tutorials Resources. Java Projects C C++ DS Interview Questions JavaScript

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

JVA-117A. Spring-MVC Web Applications

About the Authors. Who Should Read This Book. How This Book Is Organized

A Quick Introduction to Struts

Java Spring Hibernate Interview Questions And Answers For

Vision of J2EE. Why J2EE? Need for. J2EE Suite. J2EE Based Distributed Application Architecture Overview. Umair Javed 1

Java4340r: Review. R.G. (Dick) Baldwin. 1 Table of Contents. 2 Preface

<Insert Picture Here> Accelerated Java EE Development: The Oracle Way

Contents at a Glance

Pervasive Web Application Architecture. History Scalability Availability Development Application Architecture

Specialized - Mastering JEE 7 Web Application Development

Integrated Architecture for Web Application Development Based on Spring Framework and Activiti Engine

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

Java J Course Outline

JSP. Basic Elements. For a Tutorial, see:

Advanced Java Programming

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Contents. 1. JSF overview. 2. JSF example

Appendix A - Glossary(of OO software term s)

Page 1

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

Courses For Event Java Advanced Summer Training 2018

JAVA SYLLABUS FOR 6 MONTHS

HYPERION SYSTEM 9 BI+ GETTING STARTED GUIDE APPLICATION BUILDER J2EE RELEASE 9.2

AN ISO 9001:2008 CERTIFIED COMPANY ADVANCED. Java TRAINING.

Course Content for Java J2EE

com Spring + Spring-MVC + Spring-Boot + Design Pattern + XML + JMS Hibernate + Struts + Web Services = 8000/-

J2EE Interview Questions

DVS WEB INFOTECH DEVELOPMENT TRAINING RESEARCH CENTER

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

COURSE 9 DESIGN PATTERNS

Java Web Development With Servlets, JSP, And Ejb By Budi Kurniawan

"Web Age Speaks!" Webinar Series

UNIVERSITY EXAMINATIONS: NOV/DEC 2011 REGULATION PERVASIVE COMPUTING PART A

Designing a Distributed System

Introduction to JSP and Servlets Training 5-days

Fast Track to Java EE 5 with Servlets, JSP & JDBC

PDF SIMPLE JAVA WEB SERVICE EXAMPLE

Anno Accademico Laboratorio di Tecnologie Web. Sviluppo di applicazioni web JSP

CHAPTER 4: ARCHITECTURE AND SYSTEM DESIGN OF PROPOSED EXPERT SYSTEM: ESOA

1 CUSTOM TAG FUNDAMENTALS PREFACE... xiii. ACKNOWLEDGMENTS... xix. Using Custom Tags The JSP File 5. Defining Custom Tags The TLD 6

CTI Short Learning Programme in Internet Development Specialist

Java EE 6: Develop Web Applications with JSF

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Oracle Developer Day

JAVA MICROSERVICES. Java Language Environment. Java Set Up. Java Fundamentals. Packages. Operations

Chapter 6 Enterprise Java Beans

JDK-WildFly-NetBeans Setup Local

ESIGATE MODULE DOCUMENTATION DIGITAL EXPERIENCE MANAGER 7.2

Group A: Assignment No 2

~ Ian Hunneybell: CBSD Revision Notes (07/06/2006) ~

Developing the First Servlet

Java EE 7 is ready What to do next? Peter Doschkinow Senior Java Architect

Case Study Schedule. NoSQL/NewSQL Database Distributed File System Peer-to-peer (P2P) computing Cloud computing Big Data Internet of Thing

CTI Higher Certificate in Information Systems (Internet Development)

Transcription:

SSC - Web development Model-View-Controller for Java Servlet Shan He School for Computational Science University of Birmingham Module 06-19321: SSC

Outline Outline of Topics Java Server Pages (JSP) Model-View-Controller (MVC) Java Enterprise applications

Java Server Pages (JSP) What is Java Server Pages JSPs: a Java technology that provides a simplified, fast way to create easily maintain, information-rich, dynamic Web pages based on HTML, XML, or other document types. Viewed as a high-level abstraction of Java servlets: translated into servlets at runtime from the JSP source file Requires a Servlet container, e.g., Tomcat Life cycle of JSP: very similar to Java Servlet: Step 1: JSP Page Translation: Step 2: JSP Page Compilation: Other steps are similar to Java Servlet

Java Server Pages (JSP) What is Java Server Pages JSP Page (.jsp) Translate Servlet source (.java) Compile Servlet class (.class) _jspinit() Response _jspservice() Request _jspdestroy() Servlet container Finalisation and garbage collection

Java Server Pages (JSP) How to write JSP Java Code inside HTML using special JSP tags, called JSP Scriting elements Three categories of JSP Scriting elements: Declaration Tags: define varaibales and methods in JSP, start with <%! and end with %>, e.g., <%! String username = Shan; %> Expression Tags: produce output (a String object) that can be used to display result on JSP, start with <%= and end with %>, e.g., <%=name %> Scriptlets: start with <% and end with %>, e.g., <% Date date = new Date(); %>

Java Server Pages (JSP) JSP vs Java Servlet Differences: Java Servlet is HTML in Java, while JSP is Java in HTML. Servlets run faster compared to JSP since JSP needs to be translated and compiled before execution. More convenient to write JSP to generate HTML When to use JSP: when there is not much data process and manipulation Otherwise, use Model-View-Controller design pattern, where JSP used as View and Servlet as controller

Model-View-Controller (MVC) The problem Many software systems are essentially to retrieve data from a data store, e.g., a database and display it for the user: The user changes the data using an user interface The system stores the updates in the data store Most straightforward design: combines user interface and data store to reduce the amount of coding and to improve application performance Problems: user interface tends to change much more frequently than the data storage system. mixed up the presentation (the user interface) and application logic (data store).

Model-View-Controller (MVC) What is Model-View-Controller (MVC)? MVC: a design pattern for efficiently relating the user interface to underlying data models. Three main components: Model: represents the underlying data structures in a software application and the functions to retrieve, insert, and update the data. Note: No information about the user interface. View: a collection of classes representing the elements in the user interface for the user to see on the screen Controller: classes connecting the model and the view, and is used to communicate between classes in the model and view.

Model-View-Controller (MVC) What is Model-View-Controller (MVC)? User Request Controller Return results Updates Manipulates View Model

Model-View-Controller (MVC) Advantages of MVC Better complexity management: Software separate presentation (view) from application logic (model) Consequently, code is cleaner and easier to understand Enable large teams of developers for parallel development Flexibility: Presentation or user interface can be completely revamped without touching the model Reusability: The same model can used for other application with different user interfaces

Model-View-Controller (MVC) MVC for Java Web Application Model: Plain Old Java Object (POJO) or Java Beans View: Java Server Pages (JSP) Controller: Java Sevlet, which decides: what application logic code to be applied in the model which JSP page is appropriate to present those particular results and forwards the request there A Java Sevlet Controller: handles incoming requests instantiates of model and invokes the correct application logic in the model for the request forwards the results from the model and request from the user to the appropriate view (JSP file) RequestDispatcher You can use request.setattribute or session.setattribute to pass the results to view

Model-View-Controller (MVC) MVC for Java Web Application User Request Controller (Servlet) Return results View (JSP pages) Forward Request/results Instantiate/ invoke Model (POJO/Bean)

Java Enterprise applications What is Enterprise applications? Enterprise applications: large-scale, multi-tiered, scalable, reliable, and secure network applications Three Tier architecture consists of: Presentation Tier: usually consists of clients and components that handle the interaction between clients and the business tier Application Tier (Business/Logic Tier): coordinate application, e.g., its business logic, decisions, calculations and evaluations, moves data between the presentation and data tiers. Data Tier (Enterprise Information Systems (Tier): retrieve and store data.

Data tier Application tier Presentation tier SSC - Communication and Networking Java Enterprise applications Enterprise applications 3-Tier architecture Java Enterprise Application Three Tier Architecture Browser with dynamic web pages Desktop applications Servlet/JSP/JSF componets EJB/POJO JDBC/Hibernate/JDO etc.

Java Enterprise applications Tools for Java Enterprise Application Development Java EE: the one your are learning but need learned more Spring Framework: one of the most popular open source application development framework for developing Java enterprise applications. Consists of many modules to simply development The key concept - Inversion of control: the control flow of a program is inverted, e.g., instead the programmer controls the flow of a program, the external source, e.g., Spring Framework takes control of it. The fundamental functionality - dependency injection: objects do not create other objects on which they rely to do their work. Instead, they get the objects from by a external framework component. The basic idea: to simplify development complexity by loosing couplings/dependencies between classes

Java Enterprise applications Links Java EE vs Spring Spring Tutorial - Eclipse Spring Tutorial - Netbean Spring guides