In a standard Java EE web application, a client typically submits information via an HTML or JSP form. The information is handed a Java servlet or another JSP for processing. This approach is not recommended for large projects. How come? You guessed it. It usually mixes model and presentation logic inappropriately making maintenance difficult. It would be nice if we had a framework that inherently supported MVC. Apache Struts to the rescue!
Struts was originally created by Craig McClanahan and donated to the Apache Foundation in May, 2000. It became prime a Apache project in 2005. It’s an open-source, web application framework with a focus on the View, but embraces the Model and the Controller as well.
The ActionServlet plays the role of Controller in Struts. This servlet takes care of the intricacies of linking things together via declarations in the struts-config.xml configuration file.
Requests from the client are sent to the ActionServlet in the form of Actions defined in the configuration file; such a request calls the corresponding Action class that interacts with the application’s Model . The Model code returns an ActionForward object that tells the servlet what page to send to the client. Information is passed between model and view in the form of JavaBeans. A comprehensive custom tag library allows it to read and write the content of these JavaBeans to and from the presentation layer without the need for any embedded Java code.
Struts also supports internationalization, provides validation capability for submitted data, and includes a templating technology called Tiles that allows the presentation layer to be composed from independent HTML or JSP fragments.
Apache Struts offers a lot to developers faced with complex projects. In the next article I’ll go through a simple Struts example to demonstrate how the pieces fit together.
Apache Struts training can put you on the fast track. Check it out.





Leave a Reply