Over a million developers have joined DZone.

Why Struts is Necessary for Development

DZone 's Guide to

Why Struts is Necessary for Development

· Java Zone ·
Free Resource

I am thinking of a funny answer for this :) When someone feels hungry either he can cook and eat or go to a restaurant. Most people go to restaurant because it makes our job simpler: just eating. No need to prepare food and then wash the dishes. In the same way, with Struts we b developer just has to write the business logic. Everything else will be handled by this framework. 

Struts is an open source framework which makes building web applications easier, based on Java Servlets and JSP technologies. The Struts framework was created by Craig R. McClanahan and was donated to the Apache software foundation in 2000. Struts is based on the MVC design paradigm; it is an implementation of JSP Model 2 architecture. The MVC pattern has 3 key components:

i) Model: responsible for business domain state knowledge
ii) View: responsible for presentation view of the business domain
iii) Controller: responsible for controlling the flow & state of user input

The Struts framework resides in the web-tier. Struts applications are hosted by a web container and can make use of services provided by the container, such as handling requests via HTTP and HTTPS protocols. This frees developers to focus on building applications that solve business problems.

Struts has mainly advantages only. You can say that in Struts you are using properties files for storing all variables, so that your application has no hard coding. This is the main functionality of Struts - let us suppose you are doing a project which is using the English language, but you want to enhance your project in another language such as  French or Chinese. Then there is no need to change the Action class or Bean class (no need to change anything in your complete project ). You just change your properties file.

Struts also follows a well defined order and every progammer has to follow that order. If you are a J2EE programmer, then I think you know that you are using one particular servlet as controller in which every request goes through, in the same way the Struts framework provides a way in which they implictly define all that controller functionality, you don't have to care about that.

Supposing that our we b application has a large scope and acts with several JSPs and hence large volumes of requests/responses to/from server, the controller (Servlet) becomes very complicated. In that case we should move on to Struts. Struts has an in-built servlet (Action servlet) that takes care of these and controls the navigational flow, reducing the overhead and making job simpler.

Actually, Struts combines with JSP, Servlets, custom tag, message resource and action classes...so end result is synergistic platform, which makes developing web applicaitons easier and reduces the number of developers. It is easy to troubleshoot whenever error occurs and with its tag library we can easily create JSPs.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}