What is Struts Framework?
Here in this post the struts framework has been described in simple points that will make it easy for you to understand the overall framework, its technicalities and workings.
- Struts is a framework and is available for free.
- It has two flavors: – Struts 1.x and Struts 2.x
- It is under Apache Organization.
- It is a framework used to develop web applications.
- A framework is a collection of set of classes, interfaces thet work together to provide a solution for a problem.
- The term specification means a set of standards.
- For the working of Struts 2.x. We need to meet the following requirements:
- Servlet API 2.4
- JSP 2.0
- Java 5
8. Apache Struts 2 is an element, extensible framework for creating enterprise applications.
Important points on Struts:
- It is easy to work here then Servlet and JSP.
- Struts are based on MVC (Model View Controller) Pattern.
- Struts is an implementation of MVC. In JSP it can be followed or not its upto JSP programmers/developers.
- Both Struts 1.x and Struts 2.x are implementation of MVC 2.
- There are inbuilt or can say ready made utilities in Struts that can be used with ease e.g.: Validation, Internationalization(I18N).
- Struts 1.x is complex while Struts 2.x is not.
opemSymphony – It describes a group
webwork – It describes a framework
xwork – It describes a command pattern
8. Struts 2.x is the combination of Struts 1.x and Webwork+Xwork
9. There is a provision of Intelligent default value in Struts 2.x which was not present in Struts 1.x
10. Struts 2.x is also knwon as Zero Configuration(in ref. to point no. 9).
11. Struts 1.x and Struts 2.x both are action based framework.
The following terms you should be aware to understand the complete functionality of Struts Framework. In Struts we have:
as interfaces. and
– OGNL (Object Graph Navigational Language)
as an expression language.
12. Struts is open source.
13. Business Logic is written in the action.
14. Cross cutting concern is kept inside interceptor (Common things are distributed among the concerned department).
15. Different interceptors perform different work.
16. The interceptors in Struts are known as filters.
WORKING: We will talk and study only about struts 2.x we will bring struts 1.x when there will be any need of comparison.
17. When a user clicks on a link or for any user action the control is passed to struts.xml
18. struts.xml is a file where the users action (generally events e.g. click, select, hover, etc..) are mapped with a particular action which passes the action to a particular controller for result page fetching.
19. Data related to a particular request is kept or stored in value stack and OGNL is a way to retrieve it.
– Value Stack is a data repository.
20. Struts 2.x has easy integration with Spring framework and hibernate framework.
21. Struts 2.x supports Annotation.
22. Testing is easier in Struts 2.x as compared to Struts 1.x
23. In struts 1.x data is stored in action form and than it is called in action where action form is an object but in struts 2.x data is directly handled by action.
24. Debugging is easier in struts 2.x as compared to struts 1.x
25. Tiles can be easily integrated with struts 2.x (For GUI part).
26. In struts 2.x execute() method is present in every action class, which is very popular in Struts 2.x
27. In struts 2.x any POJO can be action and any action can be POJO (Plain Old Java Object).
28. The execute() method is always public and return String.
Visit Site: struts.apache.org for further information, explorations and downloads on Struts 2.x
Please visit download section for any help on downloads.