Example & Tutorial understanding programming in easy ways.

What is the difference between struts 1.3 and 2.3?


S.no

Struts 1.3

Struts 2.3x

1

It uses config file – “struts-config.xml”.

inside WEB-INF/ folder. DEFAULT CREATED

It uses config file – “struts.xml”. inside default package (outside ur package). NEED TO CREATE.

2

The ActionForm(getter + setter) + Action class. like - LoginAction(action) / LoginForm

In Struts 2 only Action class (no need of ActionForm). getter & setter method inside Action class

3

The url pattern is like url - Login.do

The url pattern is like url - Login.action / Login

4

The action tag is - <forward>. <forward name="SUCCESS" path="/Wel.jsp"/>

The action tag is - <Result>. <result name="SUCCESS">/Wel.jsp</result>

5

for struts validation it uses – validation.xml, inside WEB-INF folder

Struts2 with validation.xml file stored inside current package or with validate() method. It is best - with validate() method.

for validations -

1- with validation.xml

2- with validate()

3- with Annotations

6

There is no concept for field label & fieldError. User Id <s:text property="userid" size="10"/>

Concept for field label & fieldError. <s:textfield name="userid" label="User Id"/>

7

There is no concept for required fields

There is concept for required field

9

We do need of type casting.

RForm b = (RForm)form;

There is no need of any type casting. getUserId() + getPass() - direct use. or userId pass - direct use

10

It works with open/normal format

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.

11

There is no support for collection framework for form designing

There support for collection framework for form designing

12

There is no need of Action class for form design.

There is need of Action class for form design. - major use

13

It is very basic and more comlex.

More advance - we have some extra concept for form design like - auto completer + date time picker + Tree + tabbed page + Generator + double select etc.

14

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)

We can use getter method of action class direct with property tag on response page.


Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!