Chapter 10: Building Struts Apps with Ant and XDoclet


This chapter introduces Struts and shows how to use XDoclet to cut down on the work needed to use the framework. Struts, produced under Apache Jakarta, is probably the most well-known of the Web frameworks available today. In fact, entire books have been written on using Struts. Our goal in this chapter is to give you an introduction to using Struts without XDoclet in order to show the amount of work necessary to use the framework, and then we'll show how XDoclet can help with the situation. We will use an example registration system to illustrate the concepts.

Brief Introduction to Struts

As mentioned above, there are entire books written on the topic of Struts, so this section will be a short introduction to the major components of the system. Following is a flow diagram of what occurs within the Struts framework.

click to expand

As you can see from this diagram, the entire process starts with a home page of sorts that presents the user with links or HTML forms to be filled out. In our example later in the book, we will be presenting the user with a form to register with a Web application. When the user clicks the link or the Submit button, the Struts ActionServlet will be invoked. This servlet is designed to take the URL specified in the action attribute of the HTML form or the link URL and determine an action to perform. The action is defined in a configuration file along with the Action class, action JavaBean, and the response HTML pages. The Action class is defined around the Action baseclass, and the form data is defined around the ActionForm. The HTML response pages are typically written in JSP.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net