[ Team LiB ] Previous Section Next Section

Chapter 19. Working with Struts

by Steve Steffen

IN THIS CHAPTER

The Struts framework, created in 2000 as an open source product and released in 2001 under the Apache Software Foundation license, has become the framework of choice for developing JavaServer Pages (JSPs). The Struts framework enables Web applications to decouple the business logic from the presentation layer. That enables programmers to write detailed business logic as Java objects while the JSP pages take care of displaying the actual presentation. The framework implements an MVC (Model-View-Controller) design architecture.

The Struts framework enables flexible and adaptable Web applications to be written on the WebLogic platform. JSP pages are written to contain presentation code, with the business logic contained in the action classes called from the JSPs. The actual mappings to the JSPs and the action classes are contained in an XML file. This enables the programmer to easily change which pages are called and when. Additional pages can be added, or other pages replaced, by simply remapping the XML file.

The Struts framework allows the separation of work among the Web designers, application programmers, and administrators. This enables multiple tasks to be performed at once without requiring Web designers to look at any Java code or Java programmers to look at HTML. Administrators can then modify the order of the pages without having a Java programmer modify a servlet or JSP file.

These benefits are even more obvious when a large site is being maintained. Pages can be exchanged and replaced by simply modifying the XML file, which helps to avoid embarrassing glitches, such as pages being overwritten or information on those pages being lost.

This chapter first tackles how to install Struts on a WebLogic application and then how to define the configuration. Finally, the chapter explains how to write the different parts of a Struts application. This chapter is meant only as an introduction because there isn't enough space here to cover all aspects of Struts. Whole books could be written on the topic.

    [ Team LiB ] Previous Section Next Section