Dec. 26, 2009, 6:42 p.m.
posted by reo
Web Application Life CycleThe 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 standalone 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:
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 HelloWorld–style application. This application allows a user to enter a name into an HTML form as in Figure. 1. Greeting Form![]() It then displays a greeting after the name is submitted as in 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 (page xx). |
- Comment

