Upload
cpdindia2
View
511
Download
4
Embed Size (px)
DESCRIPTION
Apache Struts is a free, open-source, MVC framework for creating elegant, modern Java web applications. It favors convention over configuration, is extensible using a plugin architecture, and ships with plugins to support REST, AJAX and JSON.
Citation preview
Struts Framework
Call Us: 01165164822
CPD TECHNOLOGIESAN ISO 9001:2008 Certified Organization
TM
Add:- Block C 9/8, Sector -7, Rohini, Delhi-110085, India
Overview What is Framework ? Characteristics of Framework. Role of a Framework. Need of a Framework. Struts Framework. Components of Struts. Working of Struts MVC. Anatomy of Struts Application. Merits of Struts. Limitation of Struts. Alternative to Struts.
Framework Framework is a set of classes and interfaces that helps in
building an application
A good framework should provide generic behavior that can be utilized across many different types of applications
Characteristics of a Framework Consist of various classes or components which gives an
abstraction of a specific concept
Gives definition of how these classes or components work with each other to provide a solution to a problem
Components and classes can be reused
Provide an organised pattern of an application
Role of a Framework Framework captures the design decisions that are
common to an application domain
Role
Creation and Usage for Particular Domain
Ease of Maintenance
Allow direct Execution and Reuse directly
Propagate design reuse over code reuse
Need of a Framework Required for developing rapid, extensible, loosely coupled
and highly cohesive applications
Needed to incorporate the following features in software design process Modularity - Encapsulating the application specific details, which
may change and separate it from a stable interface
Extensibility - Ease with which a new behavior can be added depending upon the application domain
Reusability - By defining generic components that can be reapplied to create new applications
Inversion Of Control (IOC) - Design pattern which reduces the tight coupling between associating object by creating separate event handler objects.
Struts Struts is an open source java-based web application
framework
Offer a unified framework based on MVC 2 Architecture
Developed by Craig Mcclanahan and supported by Apache Software Foundation’s Jakarta group
This framework resides in the web tier, and the struts application are hosted by a web container
Basically consist of two entities First, It is an MVC application
Second, Has a set of utilities and libraries as tool set to build web applications
Struts Framework The major components of Struts framework are:
Basic framework
Provide the MVC 2 functionality
Tag Libraries
Helps to view logic in JSP
Tiles-Plugin
Sub-framework allows the reuse of presentation code
Validator-Plugin
Sub-framework, facilitates validation of data on server as well as on the client side
Working of Struts MVC
Implementing Struts in MVC
JSP(View)
JSP(View)
Action Servlet(Controller)
Action Class 1
Action Class 2
Action Class 3
Model
Anatomy of Struts Application Create the required view (JSP/HTML) pages
Create the ActionForm Bean
Configure ActionForm Bean in struts-config.xml
Create the Application’s Controller component (ActionServlet)
Configure ActionServlet in web.xml file
Create the Controller component (Action)
Define the relationships that exists between the views and Controller in struts-config.xml
Configure struts-config.xml file in web.xml
Build and Run the Application
Merits of Struts Code Extensibility
Many Struts values are represented in XML or in property files, so changes can be made to the file without recompiling the java code
Supports for Localization and Internalization Using ResourceBundle
Simple Request Processing Mechanism Provides several utilites, such as StructValidatorUtil,
MessageResource class and so on, which simplifies the request processing mechanism
Model-View Communication Provides a set of taglib tags which allows us to create HTML forms
that directly associates with JavaBean component
Input Validation Provide built-in capability for validation of form values
Limitation of Struts Steep Learning Curve
For smaller projects the learning curve for this framework prove to be too steep
Only MVC
Only MVC based application can be created
Single ActionServlet
Only a single ActionServlet can be used in an application, which can cause configuration variance
Event Model
Doesn’t support Event Model (Similar to Swing Component)
Alternatives to Struts Cocoon
An Apache framework for web development and separates business logic, presentation logic and component based web development. The web application is build as a “component pipeline”.
WebWork
Java based Web-application framework. Provides a strong support to build reusable User Interface templates for form control, UI themes, internationalization, client and server side validations and so on.
Jakarta Velocity
Another framework similar as Struts has a capacity to do lot more beyond just creating dynamic web content. Capable of generating SQL, PostScript, and XML form templates.
Alternatives to Struts Stxx
An extension of Struts framework to support XML and XSL without changing the Struts functionality
JSF Designed to ease the process of building GUI’s of Java Server
Application. Provides standard JSP tags and API’s which helps in managing complex HTML forms, event handling activities, and presentation of data.
Spring New framework for J2EE applications. Different from other
framework, because it provides a way to manage business objects. It is comprehensive and modular
CPD TECHNOLOGIESBlock C 9/8, Sector -7, Rohini, Delhi-110085, India
Landmark: Near Rohini East Metro Station,
Opposite Metro Pillar No-397
Telephone: 011-65164822
Mobile: +91- 8860352748
Email: [email protected]
Thank You
www.cpd-india.com
www.facebook.com/cpdtechnology