Case Study: The Design of a JSP Framework By Michael Alford March 29, 2001.

Slides:



Advertisements
Similar presentations
Personalized Presentation in Web-Based Information Systems Institute of Informatics and Software Engineering Faculty of Informatics and Information Technologies.
Advertisements

Apache Struts Technology
Web Applications Development Using Coldbox Platform Eddie Johnston.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Q: According to Intel, the Pentium conforms to the IEEE standards 754 and 854 for floating point arithmetic. If you fly in aircraft designed using a Pentium,
Apache Struts Technology A MVC Framework for Java Web Applications.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
Intro to Spring CJUG - January What is Spring? “The Spring framework provides central transaction control of various objects.” This means that any.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Submitted by: Madeeha Khalid Sana Nisar Ambreen Tabassum.
MVC pattern and implementation in java
ABSTRACT Zirous Inc. is a growing company and they need a new way to track who their employees working on various different projects. To solve the issue.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
BEST PRACTICES - Java By Configuration Use global-forwards/results Helps to avoid duplicate jsp files and redundancy forward mapping.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Author: DoanNX Version 2.0/Time: 30’. The ways to solve it There are 2 main ways:  Client-side: Using JavaScript (now one very good option is JQuery).
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
16-1 The World Wide Web The Web An infrastructure of distributed information combined with software that uses networks as a vehicle to exchange that information.
MVC and MVP. References enter.html enter.html
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Agoracast: Design and Tools Review David Wallace Croft Senior Java Architect CroftSoft Inc Talk-Java/Drink-Java Las Colinas, Texas.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
8/15/2003System Specialists Corporation How to implement BC4J with the Struts Framework Eugene Sicat Technical Architect/Project Manager System Specialists.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
1 Another group of Patterns Architectural Patterns.
Simple MVC. An example: join.jsp
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
2007. Software Engineering Laboratory, School of Computer Science S E Web-Harvest Web-Harvest: Open Source Web Data Extraction tool 이재정 Software Engineering.
Architectural pattern: Interceptor Source: POSA II pp 109 – 140POSA II Environment: developing frameworks that can be extended transparently Recurring.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
Nested componentization for advanced Web portal solutions Svebor Prstačić, dipl. ing., Dr. sc. Ivan Voras, Dr. sc. Mario Žagar.
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 7 1COMP9321, 15s2, Week.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.
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.
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
Mach-II Primer Ben Edwards An Introduction to Mach-II: An event-based, implicit invocation web-application framework.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
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.
COMP9321 Web Application Engineering Semester 2, 2016
Self Healing and Dynamic Construction Framework:
Design and Maintenance of Web Applications in J2EE
Intro to Spring CJUG - January 2013.
Java Web Application Framework
Model-View-Controller Patterns and Frameworks
The Model Layer What is Model?
Presentation transcript:

Case Study: The Design of a JSP Framework By Michael Alford March 29, 2001

Acknowledgments Xqsite, Inc.Xqsite, Inc. –Zak Jacobson –John Koszarek –Nick.Vujasin –Greg Skudlarick Orbitz LLCOrbitz LLC

Web Development

Forces Quick and easy developmentQuick and easy development Simple to maintainSimple to maintain High performanceHigh performance

Quick and Easy Development Just get the damn thing out the door!Just get the damn thing out the door! Engineers vary widely in skill/experience.Engineers vary widely in skill/experience. –Make common case very simple. –Make difficult stuff easy to plug in. Mismatch: Graphic artists work visually, while engineers work with code.Mismatch: Graphic artists work visually, while engineers work with code. Reuse previously written code.Reuse previously written code.

Simple to Maintain Low complexity.Low complexity. Easily extensible with use of patterns.Easily extensible with use of patterns. Easily configurable.Easily configurable. Straightforward to debug & monitor.Straightforward to debug & monitor. –Judicious logging. –Dont impair app server tools.

High Performance Instantiate as few objects as possible.Instantiate as few objects as possible. Cache reusable objects.Cache reusable objects. Avoid Java reflection.Avoid Java reflection. Minimize synchronization.Minimize synchronization. Minimize indirection.Minimize indirection. Minimize dynamic content.Minimize dynamic content.

Common Practices

Custom Tags Tag HandlerTag Handler –Java code –Evaluates custom tags –Properties pageContextpageContext parent tagparent tag

Benefits of Custom Tags Eliminate Java code from HTML.Eliminate Java code from HTML. Greater separation of content from presentation.Greater separation of content from presentation. Promote consistency across site.Promote consistency across site. Reusable within context of a website.Reusable within context of a website.

Liabilities of Custom Tags Designers cannot work visually.Designers cannot work visually. –Inefficient iterative back-and-forth between designer and developer. –Custom modules for visual tool? Closely tied to HTML, limiting reusability.Closely tied to HTML, limiting reusability. Lower performance versus embedded code.Lower performance versus embedded code. No industry standard set of tags.No industry standard set of tags.

JSP Model 2 (Model-View-Controller variant)

Benefits of MVC Multiple views of same model.Multiple views of same model. Pluggable views and controllers.Pluggable views and controllers. Separation of development tasks.Separation of development tasks. Reuse potential.Reuse potential. Frameworks potential.Frameworks potential.

Liabilities of MVC Increased complexity.Increased complexity. Close coupling between view & controller.Close coupling between view & controller. Close coupling of views & controllers to a model.Close coupling of views & controllers to a model. Difficulty of using MVC with some web development tools.Difficulty of using MVC with some web development tools.

Document-View Combine View and ControllerCombine View and Controller MVC variantMVC variant Java Swings UIDelegateJava Swings UIDelegate

Xqsite Page Architecture Core Classes

Design Goals Fast to develop for the common tasks.Fast to develop for the common tasks. –Even at the cost of flexibility. –Most of a website is specific to a project. Simple.Simple. Pluggable services for the hard stuff.Pluggable services for the hard stuff. JSP 1.0.JSP 1.0.

Architectural Overview

Page Container of FieldsContainer of Fields Mediator between View and Business LayerMediator between View and Business Layer The use bean tag in JSP is simple and easy to use.The use bean tag in JSP is simple and easy to use.

Page Benefits Standardizes development team on a common design.Standardizes development team on a common design. Automates validation and formatting of various types of data.Automates validation and formatting of various types of data. Automates required field handling.Automates required field handling. Extensible - add new field types or services without modifying existing architecture.Extensible - add new field types or services without modifying existing architecture. Provides file uploading services.Provides file uploading services. Easily configurable page-specific, field-specific, and locale-specific error messages; can even use a properties file.Easily configurable page-specific, field-specific, and locale-specific error messages; can even use a properties file.

Page: Init & Control <jsp:useBean id="pageObject"<jsp:useBean id="pageObject" scope="request"scope="request" class="yourPageSubclass">class="yourPageSubclass"> pageObject.onLoad(pageContext);pageObject.onLoad(pageContext); onLoadonLoad –Calls initFields –Calls business layer depending on whether this is first view or a submission of form data.

Page: Example OnLoad With Validation public void onLoad(PageContext pageContext) throws Exception { super.onLoad(pageContext); // Check if submit button was pressed if (isButtonSelected("createAccount")) { // Process the state when createAccount is clicked if (isFormValid()) { // call business objects here } if (isButtonSelected("cancel")) { // Process the state when cancel is clicked redirect("/location/of/maybe/the/previous/page"); } else { // Users initial visit or reload of page // Typically do nothing here }

Submit form back to JSP " method="POST"> " method="POST">

Page: Buttons Radio buttonsRadio buttons > > CheckboxesCheckboxes > >

Page: Text Field and Error Messages String getErrorMessage(String key, String fieldName)String getErrorMessage(String key, String fieldName) String getRequiredMessage(String fieldName)String getRequiredMessage(String fieldName) JSP:JSP: ' required="true"> ' required="true">

Field Abstract Class abstract void validate();abstract void validate(); boolean isRequired();boolean isRequired(); boolean isValid();boolean isValid(); read/write properties:read/write properties: –Name –Description –Value –Invalid and Missing Messages

Field Subclasses ButtonFieldButtonField DateFieldDateField NumericFieldNumericField SelectFieldSelectField TextFieldTextField

Xqsite Page Architecture Minimizing the Designer/Engineer Conflict

PageGenerator Uses the HTML Parser sunlabs.brazil.handler.HtmlRewriterUses the HTML Parser sunlabs.brazil.handler.HtmlRewriter For every HTML page, creates a subclass of Page.For every HTML page, creates a subclass of Page. For every HTML input field, adds a Field to the Page subclass.For every HTML input field, adds a Field to the Page subclass. Stubs out the onLoad method of Page subclass.Stubs out the onLoad method of Page subclass. Creates JSP with most of the necessary code to access the Page.Creates JSP with most of the necessary code to access the Page.

HTML Layer Requirements Each input field must be named uniquely.Each input field must be named uniquely. Add a fieldType attribute to those fields that need to be specified less generically.Add a fieldType attribute to those fields that need to be specified less generically. –Will not adversely affect visual HTML editors. –Example: HTML Text field may have a fieldType attribute of DateField. Add a required attribute for those fields that the user is required to enter.Add a required attribute for those fields that the user is required to enter.

Xqsite Page Architecture Service Delegation

Interceptor Pattern Allows services to be added transparently to a framework and triggered automatically when certain events occur.Allows services to be added transparently to a framework and triggered automatically when certain events occur. Services are defined in a config file, and registered upon app startup.Services are defined in a config file, and registered upon app startup. Page class onLoad acts as central dispatcher, passing a Context object to services.Page class onLoad acts as central dispatcher, passing a Context object to services.

Context control Context object provides accessors for services to retrieve state information.Context object provides accessors for services to retrieve state information. Context object provides mutators so that services may modify request.Context object provides mutators so that services may modify request. Example: Authorization service forwards user to a login page by setting target on Context object.Example: Authorization service forwards user to a login page by setting target on Context object.

Possible Services File uploadFile upload ConfigurationConfiguration Authorization/AuthenticationAuthorization/Authentication ThrottlingThrottling LoggingLogging 3 rd -Party Integration3 rd -Party Integration

Applying Page Concepts to Current Industry Practices

Adopt Custom Tags All Field subclasses can be made into custom tag handlers.All Field subclasses can be made into custom tag handlers. PageGenerator creates a JSP of custom tags instead of embedded Java code.PageGenerator creates a JSP of custom tags instead of embedded Java code.

Adopt MVC Eliminate Page in favor of FrontControllerEliminate Page in favor of FrontController Make FrontController a Interceptor dispatcher.Make FrontController a Interceptor dispatcher. If using Struts, PageGenerator can create an ActionForm.If using Struts, PageGenerator can create an ActionForm.

Other Java-based Web Frameworks StrutsStruts WebMacro and VelocityWebMacro and Velocity HyperQbsHyperQbs JanxJanx WebWorkWebWork Cocoon (XSP)Cocoon (XSP) Resin (XTP)Resin (XTP) BrazilBrazil

References Crupi, Malks, Alur, Core J2EE Patterns, or Articles/J2EE/patterns/ Articles/J2EE/patterns/ Articles/J2EE/patterns/ Gamma, et al.,(aka Gang of Four), Design Patterns Buschmann, et al., Pattern-Oriented Software Architecture; A System of Patterns Schmidt, et al., Pattern-Oriented Software Architecture; Patterns for Concurrent and Networked Objects Struts Framework,