Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Programming / Difference Between Struts and Struts2

Difference Between Struts and Struts2

July 24, 2011 Posted by Indika

Struts vs Struts2

Struts (also known as Apache Struts or Struts 1) is a cross-platform open source framework written in Java, which is intended for developing Java EE web applications. It was one of the initial Java EE web application frameworks. But few years later, Struts2 (or Struts version 2) arrived, and it was a completely different and highly improved web application framework. It had addressed few issues that were perceived as deficiencies in the initial version. Now, Struts2 is being used very heavily for developing Java EE applications in the world.

What is Struts?

Struts (Struts 1) framework was one of the initial web application frameworks for developing Java EE web applications. Struts framework encourages the usage of MVC (Model-View-Controller) architecture. It is an extension of Java Servlet API. Craig McClanahan is the original creator of Struts. Initially it was known as Jakaratha Struts and was maintained under Jakarta Project of Apache Software Foundation. It is released under Apache License 2.0. Struts framework is called a request-based framework, and it is made up of three main components: a request handler, a response handler and a tag library. Standard URI (Uniform Resource Identifier) is mapped to a request handler. Response handler is responsible for transferring control. To create interactive applications with forms, the features offered by the tag library can be utilized. Struts support REST applications and various technologies like SOAP, AJAX, etc.

What is Struts2?

Struts framework was perceived to contain certain limitations (mainly the lack of separation between the presentation layer, request handling layer and the model) by the Java EE developers at that time, and consequently few years later Struts2 arrived. Actually, Struts2 was completely different from Struts. In fact, they did not even share the same code base because Struts2 was simply the result of renaming the WebWork 2.2 framework (i.e. WebWork and Struts communities who worked separately for some time ultimately joined hands to come up with Struts2). Its current stable release is version 2.2.3, which was released in May, 2011.

What is the difference between Struts and Struts2?

One of the many problems of Struts framework was the need for programming to abstract classes instead of interfaces. This was solved by Struts2 framework. For example, Struts framework required Action classes to be extended from the abstract base classes, but Struts2 Actions can implement an Action interface. Due to the differences in the threading model between the two versions thread-safety issues that came up in Struts framework regarding Action objects does not occur in Struts2 framework. The reason is Struts2 Action objects are instantiated for each request, while an Action in Struts framework has only one instance to handle all requests for that Action. Unlike the Actions in Struts framework, Struts2 Actions are not dependent on the Servlet API.

Testability of Struts2 framework is comparatively higher than Struts framework. You can test Struts2 Actions simply following the three steps: instantiation, setting properties and invocation of methods. Harvesting input is easier in Struts2 framework as Action properties are used as input properties, without having to keep a second input object. Apart from the support for JSTL integration (which is present in Struts), Struts2 framework can use more powerful and expressive OGNL (Object Graph Notation Language). For type conversion, Strut and Strut2 use Commons-Beanutils and OGNL, respectively. Because of these improvements, Struts2 framework is considered a highly mature framework and it is very popular among Java EE programmers. On the other hand, Struts framework is now considered obsolete.

Related posts:

Difference Between Struts and Spring MVC Difference Between ASP and ASP.NET Difference Between SOA and Web Services Difference Between Weblogic and Jboss Difference Between EJB2 and EJB3

Filed Under: Programming Tagged With: AJAX, Apache License 2.0, Apache Struts, Commons-Beanutils, Jakaratha Struts, Java EE, Java EE web application frameworks, Java Servlet API, MVC architecture, OGNL, request-based framework, REST, Soap, struts, Struts 1, Struts 2.2.3, Struts version 2, Struts2, Struts2.2.3, WebWork 2.2

About the Author: Indika

Indika, BSc.Eng, MSECE Computer Engineering, PhD. Computer Science, is an Assistant Professor and has research interests in the areas of Bioinformatics, Computational Biology, and Biomedical Natural Language Processing.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

What is the Difference Between Free Radical Substitution and Nucleophilic Substitution

What is the Difference Between Free Radical Substitution and Nucleophilic Substitution

Difference Between Sardines and Anchovies

Difference Between Rye Whiskey and Whiskey

Difference Between Cell Organelles and Cell Inclusions

Difference Between Cell Organelles and Cell Inclusions

What is the Difference Between E-learning and Blended Learning

What is the Difference Between E-learning and Blended Learning

Latest Posts

  • What is the Difference Between Diphtheria and Whooping Cough
  • What is the Difference Between Polyester and Satin
  • What is the Difference Between Syphilis and Gonorrhea
  • What is the Difference Between Stainless Steel and Sterling Silver
  • What is the Difference Between Infrared and Induction Cooker
  • What is the Difference Between Polyester and Viscose
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018 Difference Between. All rights reserved. Terms of Use and Privacy Policy: Legal.