Web services test code generator
Klaus Berg has recently released a test-code generator for JUnit-based Web service clients. If you're developing Web services using Axis2 and XMLBeans this wizard could turn your JUnit test client coding into a powerful code generation process. It also has uses for those using GUI-based testing tools like soapUI.

Newsletter sign-up

Sign up for our technology specific newsletters.


Email Address:

Adopting Struts 2.0

The framework for the next generation of Java Web applications

While the Struts framework has been widely deployed, there's no doubt that its original version held room for improvement. The newly released Struts 2.0 carries much of the power of its predecessor but is simpler for developers to use. In this article, S. Sangeetha and S. V. Subrahmanya outline the changes in Struts 2.0 and offer migration pointers for developers familiar with the Struts framework.

Apache Struts is a very popular Web framework for developing Web applications using Java Enterprise Edition (JEE). The Apache Struts Project is the open source community that develops and maintains the Struts framework. Apache Struts (or simply Struts) was released in July 2001. Since its release, it has become the de facto standard for building Web applications using JEE.

The recently released Struts 2.0 is an elegant, extensible framework for building enterprise-ready Web applications using Java code. The framework is designed to streamline the development cycle, from building to deploying to maintaining applications over time. Following an in-depth introduction to the architecture of Struts 2, you'll examine code samples that illustrate its advances over Struts 1.0, and get some tips for migrating and integrating code written for the earlier Struts framework with Struts 2.0.

This article assumes prior familiarity with Struts 1.0. If you are familiar with Model-View-Controller (MVC)-based Web development but haven't used Struts before, you may want to read "Struts 2.0 in action" (JavaWorld, October 2007) to learn the basics of Java Web application development using the Struts framework.

A brief history of Struts 2.0

The Struts framework was created so that developers could build servlets or JavaServer Pages in which database code, page design code and control flow code were not co-mingled. Applications that have code intermixed in this way become difficult to maintain as they grow larger. The Struts framework is based on the MVC architecture, which helps developers create dynamic Web applications with clear separation of concerns.

The Struts framework provides its own Web controller component for handling control-flow logic. For the view, it integrates with other technologies, such as JavaServer Pages (including JSTL and JSF), Velocity Template Engine and XSLT. For the model, it uses technologies such as JDBC, EJB, Hibernate or iBATIS for data access.

Struts 1.0 is mature, well supported by a large developer community, and widely documented. But over the last few years, a lot of open source community Web frameworks have come onto the scene, and there's been a need to keep up with the changing requirements for Web applications; thus, there has been an impetus for the creation of the next generation of the Struts framework. The initial proposal that sought to fill this need was Struts Ti, a simplified Model 2 framework for developing Web applications for those who are in need of less configuration and better structure and controller features. Another framework that was considered for this purpose was Apache Shale; however, Shale is a component-based framework that is based on JSF. The Shale developer community was hesitant to unify with Struts and has decided to continue developing Shale as a separate top-level project.

The WebWork project was started by the Open Symphony community and was aimed at the Struts developer community. It catered to the needs of people who were looking for a framework similar to Struts but with better features. The WebWork framework was released in 2002. After working independently for several years, the WebWork and Struts communities joined forces in December 2005 to create a new version of Struts; in essence, Struts 2 is Struts 1 plus WebWork. The new version of Struts is simpler to use, and closer to the original vision for the Struts framework.

Discuss

Start a new discussion or jump into one of the threads below:
.Adopting Struts 2.0
By AthenAdministrator
5 06/18/08 06:55 AM
by Anonymous
.combining Struts1 and Struts2
By KWilmink
3 06/18/08 06:54 AM
by Anonymous
.Struts2 Issue
By skh
2 06/18/08 06:54 AM
by Anonymous


Resources
"Struts 2.0 in action," (Venkatray Kamath, JavaWorld, October 2007) is an introduction to Struts 2 for Java developers who are new to the framework. "Ajax programming with Struts 2" (Oleg Mikheev, JavaWorld, August 2007) shows you how to create dynamic, Ajax-style tables using Struts 2, Dojo and JSON. The Struts homepage at the Apache Software Foundation hosts many resources for learning more about Struts 1 and Struts 2, including "Struts 1 in a nutshell," an introduction to the earlier version of this framework, and an in-depth look at the Struts 2 architecture. Matt Raible offers a slideshow presentation on migrating from Struts 1 to Struts 2 (document is a PDF). For more about migration from Struts 1 to Struts 2, see "Migrating Struts apps to Struts 2" (Ian Roughley, InfoQ, September 2006). "Web apps in a snap" (Erik Swenson, JavaWorld, March 2003) is one of several articles on JavaWorld introducing OpenSymphony's WebWork framework. Dan Brown has written a developer's history of Struts 2 (O'Reilly's OnJava.com, October 2006). See the JavaWorld Java Enterprise Edition research center for more articles about Java Web application development with the Struts framework.



You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser