Differences between struts 1 and 2
There are the following difference between the two releases of the apache
1. In this version we uses config file – “struts-config.xml” file to configure the struts controller. This file is need to create inside WEB-INF/ folder.
2. The ActionForm(getter + setter) + Action class. like - LoginAction(action) / LoginForm
3. The url pattern is like url - Login.do
4. for struts validation it uses – validation.xml, inside WEB-INF folder
5. There is no concept for field label & fieldError. like User Id
6. There is no concept for required fields
7. We do need of type casting.
8. RForm b = (RForm)form;
9. It works with open/normal format
10. There is no support for collection framework for form designing
11. There is no need of Action class for form design.
12. It is very basic and more comlex.
13. In this version we can't use action form field values on response
page(means can't call getter method of action class on response page for that we
need to set request attribute)
1. In this version we uses config file – “struts.xml”. inside default package (outside ur package).
2. In Struts 2 only Action class (no need of ActionForm). getter & setter method inside Action class
3. The url pattern is like url - Login.action / Login
4. Struts2 with validation.xml file stored inside current package or with validate() method. It is best - with validate() method.
5. For validations - 1- with validation.xml, 2- with validate() method, 3- with Annotations
6. Concept for field label & fieldError.
7. There is concept for required field
8. There is no need of any type casting. getUserId() + getPass() - direct use. or userId pass - direct use
9. It work with table format - with table (Table format is the major problem of struts2) but if we design the form with simple theme then form design with open format.
10. There is support for collection framework for form designing
11. There is need of Action class for form design. - major use
12. More advance - we have some extra concept for form design like - auto completer + date time picker + Tree + tabbed page + Generator + double select etc.
13. We can use getter method of action class direct with property tag on response page.