Introduction to Struts1.1

Source: Internet
Author: User
Learn about MVC
MVC is short for Model, View, and Controller. MVC is the design mode of Application development, that is, Model2. in the design mode of MVC, in Application development, you must separate business logic, interface display, and data. That is, data, control (business logic), and display (page display) are implemented in Model, View, and Controller respectively ).
In the past or traditional Web Application development methods, such as Asp, Php, and Jsp (Model 1) development, we implemented everything in Asp (Php, Jsp), such: obtain the required data from the database and display the data on the page and extract the data from the form submitted on the page according to the association and actual needs, query related data from the database or write data to the database based on the business logic. In other words, we implement everything in Asp (Php, Jsp), including Interface Display, business logic, and data access. The consequence is that the Asp (Php, Jsp) you write has no layers, and the Html and Script (JavaScript, JScript, Asp, Php, Jsp source code) are nested with each other. poor maintainability. The most terrible thing is that a piece of Web Application is usually displayed by the artist. In many cases, you write Asp, Php, and Jsp first and then beautify them, it is very likely that you will find that your code is completely out of sight after being processed by the artist. You have to reorganize your code.
In the MVC mode, the solution to this problem is: View is responsible for displaying the data that has been processed from the Controller and then displayed on the page, it should be said that very few scripts are nested in Html. basically, the changes made by the artist will not discard the fruits of your work.
You can choose from several development methods that comply with the MVC design pattern when developing Web applications using Java.
1: Jsp + Servlet + JavaBean (EJB)
2: Jsp + JavaBean (Controller) + JavaBean (EJB) (Model)
3: TDK (Turbine, Velocity ...)
4: Xsp
5: Jsp + Struts + JavaBean (EJB)
I personally think the latter two are better, and the other two have advantages, especially the use of TDK, because there is a better tool that can automatically generate a lot of code, as for its shortcomings, I will introduce them in the comparison of the following development methods.

New features of Struts1.1
Struts1.1 has some good functions compared with 1.0. The most important thing is that the function of form verification is enhanced. The validation of Struts1.1 data is not as detailed in validator in the previous Action, but in validation. xml through Configuration Implementation. The advantage of doing so is that the reusability is enhanced a lot.
Main components of Struts1.1 implementation
It mainly includes Action, ActionForm, ActionMapping, and ActionForward. In development, the most important write is Action, and ActionForm can be written or not written as needed. I will introduce them one by one.

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.