The Struts framework is an open-source product for building Web applications based on the model-view-controller (MVC) design. It uses and extends the Java Servlet API. It features a powerful custom tag library, tiled displays, form validation, and internationalization. Also, Struts supports a variety of presentation layers, including JSP, XML/XSLT, JavaServer Faces (JSF), Velocity, as well as a variety of model layers, including JavaBeans and EJB. In a standard Java EE web application, the client will typically submit information to the server. The information is then either handed over to a Java servlet which processes it, interacts with a database and produces an html-formatted response, or it is given to a JSP document which intermingles HTML and Java code to achieve the same result.
Both approaches are inadequate for large projects because they mix application logic with presentation and make maintenance difficult. The goal of Struts is to cleanly 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 Action Servlet) and facilitates the writing of templates for the view or presentation layer. The web application programmer is responsible for writing the model code, and for creating a central configuration file struts-config. xml which 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 which interacts with the application specific model code. The model code returns an "ActionForward", a string telling the controller which output page to send to the client. Information is passed between model and view in the form of special java beans. 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.
Java Development India offers Java Strut development, Java Strut consulting and Java Strut related solutions from our offshore software development outsourcing centre at Kochi, Kerala in India.
|