Comparison of two MVC frameworks for struts and spring

Source: Internet
Author: User
Tags comparison html tags java web

The web-based MVC framework is an unprecedented boom in the world of Java EE. A new MVC framework is published almost every two weeks on the TTS Web site. At present, the better MVC, the veteran has struts, webwork. The emerging MVC framework is Spring MVC, Tapestry, JSF, and so on. These are mostly the works of the famous team, as well as some of the work of the Fringe team, also quite outstanding, such as Dinamica, Vraptor and so on. These frameworks provide a good level of separation capability. On the basis of a good MVC separation, the provision of some out-of-the-box auxiliary class libraries also facilitates productivity improvement.

How to choose a good framework application in your project will be critical to the efficiency and reusability of your project. This article will introduce the two kinds of framework which are most popular and most commonly used.

First, Struts

Struts is part of the Jakarta Project under the Apache Software Fund. The main architectural design and developer of the Struts framework is Craig R.mcclanahan. Struts is the undisputed king of the current Java WEB MVC framework. After five years of development, struts has grown into a stable, mature framework, and occupies the largest market share in the MVC framework. But some of the technical features of struts have lagged behind the emerging MVC framework. In the face of Spring MVC, WEBWORK2, a more sophisticated and scalable framework, struts has faced unprecedented challenges. But in terms of product development, struts is still the safest option.

Struts consists of a set of mutually collaborative classes (components), Serlvet, and JSP tag lib. The Web application based on struts architecture basically conforms to the design standard of JSP Model2, which can be said to be a kind of change of MVC design pattern. Based on the description of the framework, it is easy to understand why struts is a web framwork, not just a combination of some tag libraries. But Struts also contains a rich tag library and utility classes that work independently of the framework. Struts has its own controller (Controller), while consolidating other technologies to implement the model and view layers. At the model level, struts can be easily combined with data access technologies, including EJB,JDBC and object Relation Bridge. In the view layer, struts can be combined with JSP, Velocity templates,xsl, and so on, these presentation layer components.

The architecture of Struts

The struts framework is the embodiment of the MVC pattern, and here we look at the Struts Architecture (architecture) from the model, view, and control.

From view angle

Built primarily by JSP, struts itself includes a set of extensible custom Tag libraries (TAGLIB) that simplify the process of creating a user interface. Currently includes: Bean tags,html tags,logic tags,nested tags,template Tags these several taglib. For more information, refer to the Struts user manual.

From model angle (mode)

The model mainly represents the state of a system (sometimes, the business logic operation that changes the state of the system is also divided into the model). In struts, the state of the system is mainly represented by actiomform beans, which are typically non-persistent. If you need to convert these states to persistent data storage, struts itself provides a utitle package that can be easily manipulated with the database.

From the controller angle (Controller)

In the struts framework, controller is primarily Actionservlet, but operations on the business logic are mainly performed by action, Actionmapping, Actionforward These components are coordinated (perhaps these components should be divided into the business logic piece in the model). Where the action acts as the real business logic implementation, actionmapping and Actionforward specify the direction of the different business logic or process.

For struts to control and process customer requests, let us specify this by introducing the four core components of struts. These are the following components: Actionservlet. Action classes,action Mapping (here includes Actionforward), Actionfrom Bean.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.