30 thg 9, 2007

Struts

DangLVH

Struts is a open source framework which make building of the web applications easier based on the java Servlet and JavaServer pages technologies.

Struts framework was created by Craig R. McClanahan and donated to the Apache Software Foundation in 2000. The Project now has several committers, and many developers are contributing to overall to the framework.

Developing web application using struts frame work is fairly complex, but it eases things after it is setup. It encourages software development following the MVC design pattern. Many web applications are JSP-only or Servlets-only. With JSP and Servlets, Java code is embedded in the HTML code and the Java code calls println methods to generate the HTML code respectively. Both approaches have their advantages and drawbacks; Struts gathers their strengths to get the best of their association.

Struts is based on Model-View-Controller (MVC) design paradigm, it is an implementation of JSP Model 2 Architecture. For more of Model-View-Controller (MVC) click here.

Consists of 8 Top-Level Packagesand approx 250 Classes and Interfaces.

Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design. This definition
implies that Struts is a framework, rather than a library, but Struts also contains an extensive tag library and utility classes that work independently of the framework.

The overview of struts

Client browser
An HTTP request from the client browser creates an event. The Web container will respond with an HTTP response.

Controller
The controller is responsible for intercepting and translating user input into actions to
be performed by the model. The controller is responsible for selecting the next view based on user input and the outcome of model operations.The Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The struts-config.xml file configures the Controller.



Business logic
The business logic updates the state of the model and helps control the flow of the application. With Struts this is done with an Action class as a thin wrapper to the actual business logic.

Model
A model represents an application’s data and contains the logic for accessing and manipulating that data. Any data that is part of the persistent state of the application should reside in the model objects. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. Model services are accessed by the controller for either querying or effecting a change in the model state. The model notifies the view when a state change occurs in the model.The JSP file reads information from the ActionForm bean using JSP tags.

View
The view is responsible for rendering the state of the model. The presentation semantics are encapsulated within the view, therefore model data can be adapted for several different kinds of clients.The view modifies itself when a change in the model is communicated to the view. A view forwards user input to the controller.The view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like Velocity.

MVC










Struts Internationalization

For more information here:
http://www.allapplabs.com/struts/struts.htm
http://struts.apache.org/

About the Author

DangLVH / Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

2 comments:

  1. Ủa, sao Đăng không chỉ ra trang chủ của nó luôn? apache.org
    Hiện tại struts là 1 trong những framework được sử dụng rộng rãi nhất trong thế giới J2EE, các công ty tuyển dụng thường sẽ hỏi kinh nghiệm LTV với các framework này.
    Hiện tại có một anh nữa cũng nổi đình nổi đám là Spring.
    Nghiên cứu Struts không khó lắm, thử xem sao.
    Hiện nay đã có bản Struts 2, đây có thể xem như sự kết hợp của Struts 1 và Webwork (1 framework khác) cũng hay lắm.
    À còn nữa, JSF (không phải JSP nha) cũng rất đáng mặt đó.

    Trả lờiXóa
  2. dạ, thank YHT nhiều, trong lúc em search thì tình cờ có được thông tin này nên em muốn collect nó lại làm tài liệu để học và share cho mọi người. Để em vào trang apache kiếm thêm thông tin nữa

    Trả lờiXóa

Recent Posts

Posts

Popular Posts