Compare Struts to ASP.NET

by lichen 7/18/2007 4:40:00 PM

Struts is an MVC framework for Java web application development. Struts 1.0 was released in July 2001, roughly a year before ASP.NET 1.0. Currently, 70-80% of Java Web application developer's job requires Struts so it is fair to say that Struts is the current mainstream framework for Java web application.

Struts contains an MVC framework and a set of JSP custom tags. For a simplest application, developers need to provide:

  1. An html form in which user can enter data.
  2. A Struts bean that serves as model. The inputs in the form is mapped to the properties of the bean.
  3. An action servlet which serves as controller.
  4. One or more JSP pages that serves as view for the results.

The components are wired together with a configuration file struts-config.xml. Struts framework actually provides a servlet as front-controller in which all actions go to. The front-controller is responsible for instantiate the Struts bean, dispatch the action and route to the approprate view based on the return of the action.

In addition, Struts also supplies custom JSP tags that provides the following functionalities:

  1. Preserve the state of input if the view is same as the form.
  2. Validation.
  3. Layout with Tiles.

Struts provides serveral important functionalities in the framework and significantly reduced the repeatitive tasks in Java web development. ASP.NET does not require a regid MVC pattern like Struts (which could be both pro and con). Besides that, ASP.NET does almost every other things better:

  1. Struts still requires coding the same information twice, once in form and the second time in bean. In ASP.NET code-behind, controls are automatically created from form. In additional, ASP.NET supports rich controls, i.e., controls not available in HTML.
  2. The modle, view and controller of Struts is scattered in many files. The only place to find them is in the struts-config.xml file. It is inconvenient to work with large number of files. Although the seperation of functionalities into many classes remotes reuse, in reality, the classes are rarely reused.
  3. ASP.NET's mechanism to preserve form state is simpler to use.
  4. ASP.NET's validation architecture is better and it is transparent to render client-side Javascript depending on the type of clients.
  5. ASP.NET's master page and skin is superior to Tiles.

In conclusion, also Struts is a significant improvement over normal JSP/Serlet programming. Struts is still far behind ASP.NET in functionality and productivity. There are tools like AppFuse that would make Struts development easier. It is still nowhere near the experience with Visual Studio 2005 and ASP.NET 2.0.

Perhaps it is time to compare ASP.NET with JSF which is the latest offering in the Java world.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | ASP.NET | Java

Related posts

Comments are closed

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Pages

    Recent comments

    Authors

    Tags

      Disclaimer

      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      © Copyright 2010

      Sign in