ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

How is the MVC design pattern used in Struts framework?

The Struts Framework is a standard for developing well-architected Web applications. It has the following features:

 

Based on the Model-View-Controller (MVC) design paradigm, distinctly separating all three levels:

 

 

Model: application state

View: presentation of data (JSP, HTML)

Controller: routing of the application flow

 

1. Model Tier :

Struts includes only minimal infrastructure for the model tier

A basic implementation of javax.sql.DataSource is included

But you can integrate any desired approach

 

2. View Tier :

 Form Beans:

Represent the server side state of the input fields on an HTML form

Contains hooks for resetting fields to default values (needed for checkboxes) and input field validation

DynaActionForm means you do not have to create new JavaBeans yourself

Validation Framework:

Abstract input validation rules into separate XML document

Extensible for custom field checking

Optionally generates client-side JavaScript

Always checks on server side

Integrated with standard ActionForm beans and DynaActionForm beans

(JSP) Custom Tag Libraries:

Bean – General purpose bean and property manipulation

Html – Dynamic HTML-based user interfaces (including input forms)

Logic – Conditionals and iteration

Nested – Versions of other tags that access nested JavaBean hierarchies easily

Tiles – Layout management (next page)

(JSP) Tiles Framework:

Supports templating for common look and feel of all pages in a web app

Tile definitions created in JSP page or in external XML document

Definitions can extend base definitions

Advanced techniques for dynamically passing information to tiles

3. Controller Tier :

Configuration Document Defines Behavior

Action URLs mapped to Actions

Data sources

Exception handlers

Form beans

Forwarding URLs mapped to Pages

Message Resources for i18n

PlugIns for Lifecycle Management

One or more documents allowed

Request Processing Lifecycle :

Extract action mapping path

Select locale (if necessary)

Select action mapping to utilize

Perform role-based access checks

Server-side validation (if requested)

Invoke application Action

Forward based on application outcome

Highly customizable and extendable

Sub-Application Modules :

Logically divide single web application into multiple Struts “mini-applications”

Session state shared across all modules

Standard Action Implementations:

Forward or include other URLs

Related Posts Plugin for WordPress, Blogger...
Flag Counter