The JavaTM Web Services Tutorial
Home
TOC
PREV TOP NEXT

Web Application Life Cycle

The server-side portion of a Web application consists of Web components, static resource files such as images, and helper classes and libraries. The JWSDP provides many supporting services that enhance the capabilities of Web components and make them easier to develop. However, because it must take these services into account, the process for creating and running a Web application is different than that of traditional stand-alone Java classes.

Web components run within an environment called a Web container. The Web container provides services such as request dispatching, security, concurrency, and life cycle management. It also gives Web components access to APIs such as naming, transactions, and e-mail.

Certain aspects of Web application behavior can be configured when it is deployed. The configuration information is maintained in a text file in XML format called a Web application deployment descriptor. A deployment descriptor must conform to the schema described in the Java Servlet specification.

The process for creating, deploying, and executing a Web application can be summarized as follows:

  1. Develop the Web component code (including possibly a deployment descriptor).
  2. Build the Web application components along with any static resources (for example, images) and helper classes referenced by the component.
  3. Deploy the application.
  4. Access a URL that references the Web application.

Developing Web component code is covered in the chapters on servlet and JSP technology. Steps 2. through 4. are expanded on in the following sections illustrated with a Hello, World style application. This application allows a user to enter a name into an HTML form:

Figure 1 Greeting Form

and then displays a greeting after the name is submitted:

Figure 2 Response

The Hello application contains two Web components that generate the greeting and the response. This tutorial has two versions of this application: a servlet version called Hello1 in which the components are implemented by two servlet classes, GreetingServlet.java and ResponseServlet.java and a JSP version called Hello2 in which the components are implemented by two JSP pages, greeting.jsp and response.jsp. The two versions are used to illustrate the tasks involved in packaging, deploying, and running an application that contains Web components. If you are viewing this tutorial online, you must download the tutorial bundle to get the source code for this example. See Running the Examples.

Home
TOC
PREV TOP NEXT