Java/Struts interview questions: - How Struts 1.x differ from Struts 2.x?

665 0 0
                                    

Following is the diffrences between Struts 1.x  and Struts 2.x

Struts 1.x

 Configuration of ActionServlet via servlet.

Struts1 extends the abstract base class by its action class.

Follows FrontController pattern.

Extra care has to be taken to make resources thread safe because Actions are singletons.

Testing is a problem since execute() method exposes Servlet API.

ActionForms serves are input.

Binds objects in page using standard mechanism.

Type conversions are using common-beanutils.jar.

General notation for config file is Struts-config.xml is used.

No concept of namespace.

Struts 2.x

 Configuration of FilterDispatcher is via filters.

Implements Action interface but not a compulsion. Any POJO class can behave like Action.

Follows FilterDispacther pattern.

Action objects are instantiated for each request and hence are inherently thread safe.

Testing is easier.

Any POJO can serve as input.

Binds objects using valuestack.

Type conversions are using OGNL.

General notation for config file is struts.xml.

Namespace are readily available for modularity.

 Also see the rightside interesting video on Struts: -

Java/Struts interview questions: - How Struts 1.x differ from Struts 2.x?Where stories live. Discover now