Struts2 - Design Goals and Overview

Design Goals and Overview

In a standard Java JEE web application, the client will typically call to the server via a web form. The information is then either handed over to a Java Servlet which interacts with a database and produces an HTML-formatted response, or it is given to a JavaServer Pages (JSP) document that intermingles HTML and Java code to achieve the same result. Both approaches are often considered inadequate for large projects because they mix application logic with presentation and make maintenance difficult.

The goal of Struts is to separate the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model). Struts provides the controller (a servlet known as ActionServlet) and facilitates the writing of templates for the view or presentation layer (typically in JSP, but XML/XSLT and Velocity are also supported). The web application programmer is responsible for writing the model code, and for creating a central configuration file struts-config.xml that binds together model, view, and controller.

Requests from the client are sent to the controller in the form of "Actions" defined in the configuration file; if the controller receives such a request it calls the corresponding Action class that interacts with the application-specific model code. The model code returns an "ActionForward", a string telling the controller what output page to send to the client. Information is passed between model and view in the form of special JavaBeans. A powerful custom tag library allows it to read and write the content of these beans from the presentation layer without the need for any embedded Java code.

Struts is categorized as a request-based web application framework.

Struts also supports internationalization by web forms, and includes a template mechanism called "Tiles" that (for instance) allows the presentation layer to be composed from independent header, footer, menu navigation and content components.

Read more about this topic:  Struts2

Famous quotes containing the words design and/or goals:

    You can make as good a design out of an American turkey as a Japanese out of his native stork.
    —For the State of Illinois, U.S. public relief program (1935-1943)

    Despicable means used to achieve laudable goals renders the goals themselves despicable.
    Anton Pavlovich Chekhov (1860–1904)