STRUTS2 Tutorial--The first chapter constructs the STRUTS2 development environment

Source: Internet
Author: User
Tags garbage collection new features thread java web

On the official website of struts, the following two paragraphs are written:

Apache Struts 2 is a elegant, extensible framework for creating Enterprise-ready Java Web applications. The framework is designed to streamline the full development cycle, from building, to deploying, to maintaining Applicatio NS over time.

Apache Struts 2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts communities joined to create forces. This new version of the ' struts is simpler to ' and closer to ' how-to ' and ' to ' how ' always meant to be.

The idea is that Apache Struts2 is an excellent, extensible web framework for enterprise-class applications that is designed to streamline the development lifecycle of applications, reducing the time it takes to create, publish, and apply to applications.

Apache Struts2 Originally known as the world-famous Webwork2, after several years of development, struts and webwork community decided to be one, that is, today's Struts2.

Struts is an MVC framework based on MODEL2 that provides a good, well-structured implementation of the application's Web layer. Struts development Earlier, early struts1.x has been familiar with many Java EE programmers, after years of development, this team has become more and more large, many enterprise-class applications are based on struts development.

Struts2 and struts1.x have not been able to put together a comparison, although the MVC architecture pattern is implemented, the essence is completely different. STRUTS2 's predecessor is webwork, its implementation and function are superior to struts1.x, but, struts preconceived, many applications are based on struts, its vitality and popularity of the webwork fell to the leeward. With the new ideas and the new structure of the constant influx, especially WEB2.0 is a large number of mention, struts1.x obviously can not keep up with the changing changes, in many applications appear powerless, eventually gave birth to the Struts2.0. It can be said that Struts2.0 is changed for the change.

To a large extent, Struts2.0 can not avoid the suspicion of opportunistic. However, with the reputation of struts and the webwork of building a good framework, the two complement each other, which is indeed a golden mix and an excellent way to advertise.

The author coined this article, can download to the latest version of 2.1.0, but his charm has been the beginning of the cusp, should have a good future.

New features of Struts2

If the reader is familiar with struts1.x, it will be found that STRUTS2 has changed a great deal more than struts1.x:

Action class:

STRUTS1 requires the action class to inherit an abstract base class. A common problem with Struts1 is programming with abstract classes rather than interfaces.

The Struts 2 action class can implement an action interface or implement other interfaces to make optional and custom services possible. STRUTS2 provides a actionsupport base class to implement commonly used interfaces. The action interface is not required, and any Pojo object that has an execute identity can be used as a Struts2 action object.

Threading Mode:

The struts1 action is a singleton pattern and must be thread-safe because only one instance of the action handles all requests. A single example strategy limits what Struts1 action can do, and is particularly cautious when developing. The action resource must be thread safe or synchronized.

The struts2 Action object produces an instance of each request, so there is no thread-safe issue. (In fact, the servlet container produces many disposable objects for each request, and does not cause performance and garbage collection issues)

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.