Download PDF Home History |  | API Search Feedback FAQ

> ## Web Application Life Cycle

> A Web application consists of Web components, static resource files such as images, and helper classes and libraries. The Web container provides many supporting services that enhance the capabilities of Web components and make them easier to develop. However, because a Web application must take these services into account, the process for creating and running a Web application is different from that of traditional stand-alone Java classes. The process for creating, deploying, and executing a Web application can be summarized as follows:

> 1. Develop the Web component code.
> 2. Develop the Web application deployment descriptor.
> 3. Compile the Web application components and helper classes referenced by the components.
> 4. Optionally package the application into a deployable unit.
> 5. Deploy the application into a Web container.
> 6. Access a URL that references the Web application.

> Developing Web component code is covered in the later chapters. Steps 2 through 4 are expanded on in the following sections and illustrated with a Hello, World-style presentation-oriented application. This application allows a user to enter a name into an HTML form (Figure 3-3) and then displays a greeting after the name is submitted (Figure 3-4).

> Figure 3-3 Greeting Form

> Figure 3-4 Response

> The Hello application contains two Web components that generate the greeting and the response. This chapter discusses two versions of the application: a JSP version called `hello1`, in which the components are implemented by two JSP pages `(index.jsp` and `response.jsp`) and a servlet version called `hello2`, in which the components are implemented by two servlet classes `(GreetingServlet.java` and `ResponseServlet.java)`. The two versions are used to illustrate tasks involved in packaging, deploying, configuring, and running an application that contains Web components. The section About the Examples explains how to get the code for these examples. After you install the tutorial bundle, the source code for the examples is in `<``INSTALL``>/j2eetutorial14/examples/web/hello1/` and `<``INSTALL``>/j2eetutorial14/examples/web/hello2/`.

Download PDF Home History |  | API Search Feedback FAQ

All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.