Design and implementation of Web application based on struts technology

Source: Internet
Author: User
Tags config http request

Struts is a relatively mature framework in web development, this paper expounds the architecture and main components of struts for Web application software development framework based on MVC model, and discusses how to design the application based on struts framework with an example. The advantages of using struts framework to develop Web applications are also analyzed.

keywords Struts; model; view; controller

In recent years, the Struts framework based on MVC (Model-view-controller) model is more and more popular with web system developers. Struts is based on the current dynamic web design in the field of JSP, Servlet, XML and other related development technologies on the basis of a mainstream development architecture, with modular, flexible and reusable advantages, while greatly simplifying the development of Web applications. It reasonably separates the user representation logic, the business logic and the control logic, makes the development process concise and clear, and improves the maintainability and reusability of the software.

Struts Framework

1. Struts Architecture

Struts is an application framework of open source code based on MVC Classic design pattern, and it is a more mature framework in web development at present. Provides a highly configurable MVC development model for Web development by consolidating servlet, JSP, JavaBean, custom tags, and information resources into a unified framework.

The struts architecture implements the concept of the MVC design pattern, which maps model, view, and controller to components in a Web application. Model is built on behalf of the system State and business logic action, view is implemented by the custom tags provided by JSP and struts, and Controller is responsible for controlling the flow, which is done by Actionservlet and actionmapping.

2. Introduction of main components

Below we will struts-config from the view, control, model, and struts configuration files separately. XML to describe the architecture of struts.

(1) View: Built primarily by JSP, struts itself includes a set of extensible custom Tag libraries (TAG1 IB) that simplify the process of creating a user interface.

(2) Model: The model mainly represents a system's state and business logic. In struts, the state of the system is primarily represented by the actiomform Bean, and the business logic is typically implemented by JavaBean or EJB components.

(3) Controller: Controller mainly by the Actionservlet class and action class to implement, Actionservlet class is the struts framework of the core components, mainly responsible for receiving HTTP request information. Struts-config according to configuration file. XML configuration information that forwards the request to the appropriate action object. The action class is responsible for invoking the model's methods, updating the state of the model, and helping to control the application's process.

(4) configuration file struts-config. XML: When Actionservlet receives HTTP request information, how do you decide which action object to forward the user request to? This requires some configuration information that describes the user request path and action mapping relationship. In struts. These configuration mapping information is stored in a specific XML file struts-config. XML, in which the mapping information for each action is configured with one (action) element. These configuration information is read into memory when the system starts up and is used by struts during run time, in which each (action) element corresponds to an instance of the Actionmapping class.

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.