MVC Frameworks Alternatives to coding the MVC pattern.

Slides:



Advertisements
Similar presentations
Struts 2.0.
Advertisements

Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Apache Struts Technology
Web MVC-2: Apache Struts Rimon Mikhaiel
Struts1 Apache Struts Dr Jim Briggs. Struts2 What is Struts? Struts is an open source framework for building Java web applications Supports MVC/Model.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
JavaServer Faces Dr Jim Briggs 1JavaServer Faces.
Objectives:1. Investigate the Web application deployment descriptor 2. Install and deploy Tomcat and struts 3. Design and deploy a struts application Struts.
Apache Struts Technology A MVC Framework for Java Web Applications.
Session-01. Layers Struts 2 Framework The struts 2 framework is used to develop MVC-based web application. Struts 1.0 was released in June The.
Session-02. Index. Jsp in Struts 2 Web.xml File in Struts 2.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Building an application … with Struts! Presented by Ted Husted [ ]
Struts 2.0 an Overview ( )
Introduction to Struts 2.0 Jenny Ni Joey Feng Winddays Wang Hewmmi Zhu Heather Lv Software School,Fudan University 1.
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
Struts:The good, the bad, the ugly A detailed evaluation of Struts 1.1 and Enterprise Web Applications. By Paul Smith Ancept, Inc. (
Michael Rimov Centerline Computers Craig McClanahan Sun Microsystems O’Reilly Open Source Convention July , 2003.
UNIT-V The MVC architecture and Struts Framework.
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
Introduction to the Jakarta Struts Framework  The Topics: JavaServer Pages (JSP) Overview JSP Tags and Tag Libraries Overview Model – View – Controller.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
Java Frameworks Indy Java Users Group January 29, 2003.
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).
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
Introduction to MVC and the Jakarta Struts Framework By Gyanendra Dwivedi Software Consultant.
Jakarta Struts Presented by Object Computing, Inc. (OCI) Written by Greg Elliott
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
Standalone Java Application vs. Java Web Application
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.
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–
Fall CIS 764 Database Systems Design L8. Web ….
How to Build a Struts Application with JBuilder 9.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
BOF # The Struts Framework Community The Struts Framework Community Craig McClanahan.
JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
Struts An Open-source Architecture for Web Applications Facilitator: Tripti Shukla.
REVOLUTION TO NEXT GENERATION Struts2.0 20/02/ Avishek Arang ::
J2EE Struts 1 3 Struts: Introduction 1 4 Once you’ve coded a lot of JSP applications, you find yourself doing a lot of repetitive things. Also,
Model View Controller Architecture of Java Web Applications Dr. M V S Peri Sastry, Ph.D.[BITS-Pilani]
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
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.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
11 Copyright © 2004, Oracle. All rights reserved. Customizing Actions.
Struts Framework Day-2 Ashok Chakravarti. DataSource Usage Sample Struts-config.xml …
Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.
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.
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.
Enterprise Java v050228MVC1 Model, View, Controller Web Architecture.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
An Introduction to and This document is for purely educational purposes.
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
Introduction to Struts
The Model Layer What is Model?
JavaServer Faces: The Fundamentals
Struts BY: Tejashri Udavant..
Presentation transcript:

MVC Frameworks Alternatives to coding the MVC pattern

The problem with MVC If you want to implement the MVC pattern correctly, there will be a lot administrative code  Request processing  Error handling  View mapping  … Hard to maintain

The solution – MVC Frameworks There are several frameworks that handles the MVC pattern for us The frameworks handles things like  The frontcontroller  Request mappings What should happened with different requests  Error handling  View handling Choosing the correct view Tag libraries to help us code the view

Different frameworks There are a lot of different frameworks to choose from  Struts (from Jakarta)  Java Server Faces (a new emerging Java standard)  Vendor specific frameworks (like Oracles BC4J) We will talk about Struts

Struts A Open source framework from the Apache group Very widely used Great flexibility for the developer Easy to change the behavior after the application have been deployed  All mapping between requests and views is done in a XML- file, struts-config.xml A very rich set of Custom tags (overlapping JSTL a bit) Great support for localization and internationalization

The main parts of Struts ActionServlet RequestProcessor ActionMapping ActionForm Action ActionForward ActionError

Struts architecture in short Requests are mapped to Action in struts- config.xml  One Action per request  Determines where to go next and tells the system by using ActionForward ActionForm is mapped to a Action and is used to capture all data sent to the system (from a form)  Performs validation

ActionServlet The ActionServlet is the front controller in Struts, and it’s already implemented All incoming requests are mapped to the ActionServlet in web.xml action org.struts.action.ActionServlet action *.do

RequestProcessor Acts as a dispatcher Instantiating a request handler (Action) and a corresponding form bean (ActionForm) <action path="/editCustomerProfile" type="packageName.EditCustomerProfileAction" name="customerProfileForm" scope="request"/> <form-bean name="customerProfileForm" type="packageName.customerProfileForm"/>

RequestProcessor The path in identifies a url- pattern that should be handled by this action path=“editCustomerProfile” will be triggerd by editCustomerProfile.do

Navigation with ActionForward ActionForward is used to determine where to go <action path="/editCustomerProfile" type="packageName.EditCustomerProfileAction" name="customerProfileForm" scope="request“ input=“failure”>

ActionForward Name is a unique identifier to be able to identify where to go with a simple name, like success

Action The method ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) is executed for each mapped request execute() is the main entry point execute() returns the mapping to be used by the RequestProcessor using the simple name  return mapping.findForward("success");

ActionForm The ActionForm is automatically popluated with data from the request Used as a bridge between the view and the model

ActionErrors and ActionError ActionErrors is an array of ActionError Simplifies error handling and validation in the system ActionForm hava a method called validate() that’s called to validate the input ActionErrors errors = new ActionErrors(); if(name == null || name.length() <1) errors.add("name", new ActionError("error.name.required")); return errors; Returned errors will trigger the ActionForward defined in input of the action-mapping, i.e. error.jsp

Walk through of simple example…