Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.

Slides:



Advertisements
Similar presentations
Introduction to the Spring Framework
Advertisements

3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Apache Struts Technology
Web MVC-2: Apache Struts Rimon Mikhaiel
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.
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.
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.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
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 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.
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.
MVC pattern and implementation in java
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Struts Frameworks Extends Servlet-Controller in a function-specific Action Uses struts-config.xml file to define all function-actions Collects the data.
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.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Jakarta Struts Presented by Object Computing, Inc. (OCI) Written by Greg Elliott
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–
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 ….
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.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Struts 2 introduction. Struts 2 framework Struts 2 A full-featured web application framework for the Java EE platform The Java Servlet API exposes the.
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,
CSC 2720 Building Web Applications Frameworks for Building Web Applications.
JavaServer Faces (JSF) and Ajax Integration. Agenda 대강의 ( 정말로..) 개요 예제 아키텍트라면..
Model View Controller Architecture of Java Web Applications Dr. M V S Peri Sastry, Ph.D.[BITS-Pilani]
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.
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 …
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.
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.
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions and Spring MVC Buenos Aires, June 2009.
OOSD Using Java CBTS Framework. 11/2/04CBTS2 Servlet  A servlet is a Java program that can extends Web server’s functionality.  Servlets interact with.
Apache Struts Technology A MVC Framework for Java Web Applications.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
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.
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
Web Software Model CS 4640 Programming Languages for Web Applications
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:

Struts Framework Anna Paščenko

What is Struts?  An open source framework for building Java web applications.

A Good Framework is…  A defined support structure in which another software project can be organized and developed.

A Good Framework is…  A defined support structure in which another software project can be organized and developed.  Allows to spend more time on meeting software requirements, not on more tedious low level details of providing a working system.

A Good Framework is…  A defined support structure in which another software project can be organized and developed.  Allows to spend more time on meeting software requirements, not on more tedious low level details of providing a working system.  Provides proven and reliable design patterns and code architecture to an application.

Java Web Frameworks  > 50 open source frameworks only Struts Tapestry Spring Cocoon Maverick Echo

Struts  One of the most popular and widely used Java Web frameworks: stable and mature good documentation large user community open source developed by industry experts flexible and extendable

Struts  Application architectures based on the Model 2 approach, a variation of the classic Model- View-Controller (MVC) design paradigm.

MVC architecture  The MVC architecture divides applications into three layers: model, view, controller

MVC architecture  The MVC architecture divides applications into three layers: model, view, controller  Each layer handles specific tasks and has specific responsibilities to the other areas.

MVC architecture

 A model represents  business data and  business logic or operations that access and modify this business data notifies views when it changes provides the ability for the view to query the model about its state provides the ability for the controller to access application functionality

MVC architecture

 A view renders the contents of a model accesses data from the model and specifies how that data should be presented updates data presentation when the model changes forwards user input to a controller

MVC architecture

 A controller defines application behavior  an application typically has one controller for each set of related functionality dispatches user requests selects views for presentation interprets user inputs and maps them into actions to be performed by the model

MVC Model 2

Struts MVC

 Struts provides its own Controller component and integrates with other technologies to provide the Model and the View.

Struts MVC  For the Model, Struts can interact with standard data access technologies (JDBC, EJB), most any third-party packages (Hibernate, iBATIS, Object Relational Bridge etc.).

Struts MVC  For the View, Struts works well with JavaServer Pages, including JSTL and JSF, Velocity Templates, XSLT, etc.

Struts Architecture

Struts Controller Layer  ActionServlet  struts-config.xml  Action  ActionForward  ActionForm

ActionServlet  Handles requests to a Struts application. configured as Servlet in the web.xml file

ActionServlet  Handles requests to a Struts application. configured as Servlet in the web.xml file specifies the url pattern to be handled by the servlet

ActionServlet  Handles requests to a Struts application. configured as Servlet in the web.xml file specifies the url pattern to be handled by the servlet uses the configuration defined in struts-config.xml file to decide the destination of the request

struts-config.xml  describes a particular form bean, which is a JavaBean that implements the org.apache.struts.action.ActionForm class

struts-config.xml <!-- sample form bean descriptor for a DynaActionForm <form-bean name="logonForm“ type="org.apache.struts.action.DynaActionForm"> <form-property name="username" type="java.lang.String"/> <form-property name="password" type="java.lang.String"/> end sample -->

ActionForm  Encapsulates the form properties.  Passed to an Action class methods as a parameter.

struts-config.xml  describes a particular form bean, which is a JavaBean that implements the org.apache.struts.action.ActionForm class  configures the global mappings of logical names to mappable resources

struts-config.xml <forward name="welcome" path="/Welcome.do"/>

ActionForward  Represents a destination to which the controller might be directed after finishing the processing activities.  Is a return value of the Action class methods.

struts-config.xml  describes a particular form bean, which is a JavaBean that implements the org.apache.struts.action.ActionForm class  configures the global mappings of logical names to mappable resources  contains action definitions

struts-config.xml <action path="/Login" type="myPackage.LoginAction" <forward name="forwardNext" path="/pages/NextAction.jsp"/>

ActionMapping  Stores the mapping information.  Passed to an Action class methods as a parameter.

Action  The Struts framework provides an abstract Action class that you must extend for your own needs.  The ActionServlet calls the Action's execute() method to perform whatever task the Action class was meant to perform.  Within the overriden execute() method, you can put in whatever logic you need in order to fulfill the request.

Action public class LoginAction extends Action { /** * Called by the ActionServlet when the a user attempts to login. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Check username and password. return mapping.findForward("forwardNext"); }

Struts Examples  Several example applications are bundled with the Struts distribution: Blank - A simple template for starting new Struts applications. MailReader - The original Struts example application. Examples - Various demonstration applications combined as separate modules.