Struts framework internally is based on MVC framework. So the JSP, Java and Action classes are structured and effortlessly maintained.
Struts comes with many advantages to the application programmer while reducing the development time and making the manageability of the application easier.
What are the Advantages of Struts as a framework?
- Integrated Configuration:
Instead of hard coding information into java programs, most of the Struts values are defined in XML or property files.
Struts_config.xml file is the configuration file from where you fetch all the required information’s about your web application. This is called INTEGRATED.
All Action classes, Form bean and JSP page information are configured in Struts_config.xml, so we don’t need to search at various config file. All the configurable information is define in one place.
- Form Beans :
You don’t need to manually set the form vales to your value object (VO). All the data that we want to capture from a FORM (using request.getParameter() in Servlet).
Using Struts you don’t need to do explicitly request.getParameter(). Struts request processor will do this for you. All the input data will be set to form bean by the struts framework.
- Bean Tags:
Struts framework offers a set of custom JSP tags (bean:write, in particular) that allows you to easily output the properties of JavaBeans components.
These are concise and most useful variations of the standard jsp:useBean and jsp:getProperty tags.
- HTML tags :
Struts framework offers a set of custom JSP tags to create HTML forms associated with JavaBeans components.
- Form Field Validation :
Apache Struts Framework offers built-in capabilities for checking that form values validation.
Validation framework finds the values that are missing or check the entered form data is in a proper format, so that the framework can be automatically redisplayed with error messages and with the previously entered values maintained.
To Summarize, Strut is a MVC framework which makes developer to concentrate in to business logic than in to other aspects like HTML/page developers.
Currently Apache has released Struts 2 in competition to Spring framework that is getting popular. Struts 2 has major changes in the behavior compared to the Struts 1X framework. But Spring is leading in the race of Java frameworks as its not only supports MVC, but also many others, as it is built in a MODULAR structure.
Note: Will cover more on Struts 2 and Spring framework in the future blogs.