Struts Pros and cons

Source: Internet
Author: User

Advantages:

1. Implementation of the MVC pattern, the structure is clear, so that developers only focus on the implementation of business logic.


2. There is a wealth of tag can be used, Struts of the tag library (Taglib), if flexible to use, can greatly improve the development efficiency


3. Page Navigation
Make the system more clear in the context. Through a configuration file, you can grasp the relationship between the parts of the entire system,
This is of great benefit for later maintenance. Especially when another group of developers take over the project, this advantage is reflected

More pronounced.


4. Provide Exception processing mechanism.


5. Database Link Pool Management



Disadvantages:
First, go to the presentation layer, you need to configure forward, if there are 10 display layer of JSP, need to configure 10 times struts,
And does not include sometimes directories, file changes, you need to modify the forward, note that each time you modify the configuration,

Requires that the entire project be redeployed, and servers such as Tomcate must restart the server


Two, Struts Action must be Thread-safe way, it only allows an instance to handle all

's request. So all the resources that the action uses must be synchronized uniformly, which raises the issue of thread safety.


Third, the test is not convenient. Each Action of Struts is coupled with the WEB layer so that its tests depend on
WEB container, unit tests are also difficult to implement. However, there is a Junit extension tool Struts TestCase that can be implemented

It's unit tests.


Types of conversions. Struts Formbean all the data as String type, and it allows the labor
Type conversion with Commons-beanutils. But its transformation is at class level, and the type of transformation is

is not configurable. It is also very difficult to return the error message to the user when the type is converted.


V. The dependency on the Servlet is too strong. Struts will need to rely on servletrequest and when handling Action

Servletresponse, all of which cannot escape the Servlet container.


Vi. front-end expression language aspect. Struts integrates JSTL, so it mainly uses the JSTL expression language to

Get the data. However, the JSTL expression language is weak in terms of Collection and indexed properties.


Vii. control of action execution is difficult. Struts creates an Action, and if you want to control the order in which it is executed, it will

Very difficult. Even you have to write the Servlet again to achieve this functional requirement.


Processing of action before and after execution. When Struts handles the Action, it is based on the class hierarchies,

It is difficult to operate before and after the action is processed.


Nine, insufficient support for events. In struts, it's actually a form form that corresponds to an Action class (or
Dispatchaction), in other words: in struts it is actually a form that corresponds to only one event, struts this
Event mode is a coarse-grained
event compared to the application Event,application event and the component event

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.