Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.

Slides:



Advertisements
Similar presentations
Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Advertisements

Apache Struts Technology
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
MVC Frameworks Alternatives to coding the MVC pattern.
Model-View-Controller ("MVC") This is a architectural design pattern for interactive applications. This design pattern organizes an interactive application.
Struts1 Apache Struts Dr Jim Briggs. Struts2 What is Struts? Struts is an open source framework for building Java web applications Supports MVC/Model.
DT211/3 Internet Application Development JSP: Processing User input.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Apache Struts Technology A MVC Framework for Java Web Applications.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Agenda Web Development Chapter 7 Review Class Discussion Issues.
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.
BEST PRACTICES - Java By Configuration Use global-forwards/results Helps to avoid duplicate jsp files and redundancy forward mapping.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
Introduction to MVC and the Jakarta Struts Framework By Gyanendra Dwivedi Software Consultant.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
8/15/2003System Specialists Corporation How to implement BC4J with the Struts Framework Eugene Sicat Technical Architect/Project Manager System Specialists.
Struts2 Plugin Development - Extending Struts2 Justin Yip.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
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.
Fall CIS 764 Database Systems Design L8. Web ….
3-Tier Web Application Architecture. Simple Log-in public String button1_action() { // TODO: Process the button click action. Return value is a navigation.
How to Build a Struts Application with JBuilder 9.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
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.
Model View Controller Architecture of Java Web Applications Dr. M V S Peri Sastry, Ph.D.[BITS-Pilani]
Page 1 Controller Action2.java Struts- config. xml Mappings Business Logic Layer Data Layer View Layer Business Bean 1 Jsp Engine Jsp 1 Action3.java Action4.java.
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
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.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
11 Copyright © 2004, Oracle. All rights reserved. Customizing Actions.
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.
Model View Controller (MVC) an architecture Rick Mercer with help from many of others 1.
Chapter 9 Web Application Design. Objectives Describe the MVC design pattern as used with Web applications Explain the role and responsibilities of each.
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.
CS320 Web and Internet Programming Web Application and MVC Chengyu Sun California State University, Los Angeles.
Building KFS using KNS Presented by James SmithJustin Beltran University of ArizonaUniversity of California, Irvine.
Model View Controller. MVC is the separation of model, view and controller. It's simply a paradigm; an ideal that you should have in the back of your.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
V Web Tier Architecture MVC and Struts. v First, there were servlets And things were good Faster than CGI programs More scalable with built-in.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study.
CS520 Web Programming Spring – Web MVC Chengyu Sun California State University, Los Angeles.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Introduction to Jakarta Struts Framework Try NCCU Computer Center Mar 20,2002.
Controlling an Application with Struts
Unit 6-Chapter 2 Struts.
Design and Maintenance of Web Applications in J2EE
Building an Integrable XBRL Portal Daniel Hamm German Central Bank
The Model Layer What is Model?
Struts BY: Tejashri Udavant..
Presentation transcript:

Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern Model: application state View: presentation of that data Controller:handles routing of app Separates three elements distinctly

Model – View – Controller

Struts Framework provides Central controller – ActionServlet All paths go through controller Configurable through xml Action classes Adaptors between business layer and web tier Can unit test at this level ActionForms Hold data for each jsp page Auto-magically updated

Struts – continued Framework provides… Tag libraries Avoid scriptlets Page designers can handle Built In Internationalization Build In Validation of user input Advantages Excellent architecture and design Reuse, modularity, extensibility etc.. Established framework Open source

Struts – general Architecture Each task a path Path contains info to do that task: Action class whose perform() method will be called Form Bean to hold data to / from view Forwards to pass control to on success / failure Input jsp – auto validate user input Graphically:

Page 1 Controller Action2.java Struts- config. xml Mappings Business Logic Layer Data Layer View Layer Business Bean 1 Jsp Engine Jsp 1 Action3.java Action4.java Action1.java Business Bean 2 Business Bean 3 Jsp 2Jsp 3 Form Bean 1 Form Bean 2 Other Bean 1 request/session Web Browser MarkVision Server path action [form bean] [forwards] Jsp 2 Web Server Jsp 2 CoreSession Socket

Example Step through show and save logging parameters Note extra beans which encapsulate interaction with server LoggingBean.java ServerBean.java

Web Server creates / reuses index.htm Controller Show Logging Action.java Mappings Business Logic Layer Data Layer View Layer Jsp Engine LoggingBean.java logging.jsp Logging Form request/session Web Browser Granite Request: ShowLogging.do creates form bean in correct scope perform(mapping, form, request, response) calls business logic rule to get logging info returns forward(success) mainpulates data setCategoryList(list) forwards – logging.jsp expands custom tags response sent to browser – pure html looks up <action path="/ShowLogging" type="beans.ShowLoggingAction" name="LoggingForm"> <forward name="success“ path="/logging.jsp" /> ServerBean.java populates form values …. logging.jsp Messages Resources displays internationalized messages

Web Server creates / reuses action instance logging.jsp Controller Show Logging Action.java Mappings Business Logic Layer Data Layer View Layer Jsp Engine LoggingBean.java results.jsp Logging Form request/session Web Browser Granite form submit – action=‘SaveLogging.do’ reuses form bean in correct scope calls perform(mapping, form, request, response) getCategoryList() returns mapping.findForward("success") forwards – result.jsp expands custom tags Displays internationalized messages from bean response sent to browser – pure html looks up <action path="/SaveLogging" type="beans.SaveLoggingAction" name="LoggingForm"> <forward name="success“ path="/result.jsp" /> ServerBean.java Messages Bean add result messages auto populates using bean getters/setters becomes request parameter category[0].value added to form using LoggingForm.getCategory(0).setValue(value) For each one that user has changed… call business logic to change on server browser adds form variables to request results.jsp

if submit, auto populates form bean from request params Page 1 Controller Action2.java Struts- config. xml Mappings Business Logic Layer Data Layer View Layer Business Bean 1 Jsp Engine Jsp 1 Action3.java Action4.java Action1.java Business Bean 2 Business Bean 3 Jsp 2Jsp 3 Form Bean 1 Form Bean 2 Other Bean 1 request/session Web Browser Business Data reads on start-up creates incoming requests creates/reuses any associated form bean path action [form bean] [forwards] passes control to relevant action to handle interacts with lower layers - acts as adaptor between HTTP and layers below gets data to display (adds to beans in request/session)…or saves data from beans via business rules looks up path to determine action/ form bean returns appropriate forward relevant page called processes custom tags – fill form elements from beans, display internationalized messages pure HTML sent to browser Jsp 2 Action2.java Form Bean 2 Web Server Jsp 2