Web Application Life Cycle - The Java EE 5 Tutorial (original) (raw)
2. Using the Tutorial Examples
3. Getting Started with Web Applications
Deploying a Packaged Web Module
Updating a Packaged Web Module
Mapping URLs to Web Components
Setting Initialization Parameters
Mapping Errors to Error Screens
Declaring a Reference to a Resource
Declaring a Reference to a Web Service
Accessing Databases from Web Applications
Populating the Example Database
Creating a Data Source in the Application Server
Further Information about Web Applications
5. JavaServer Pages Technology
7. JavaServer Pages Standard Tag Library
10. JavaServer Faces Technology
11. Using JavaServer Faces Technology in JSP Pages
12. Developing with JavaServer Faces Technology
13. Creating Custom UI Components
14. Configuring JavaServer Faces Applications
15. Internationalizing and Localizing Web Applications
16. Building Web Services with JAX-WS
17. Binding between XML Schema and Java Classes
19. SOAP with Attachments API for Java
21. Getting Started with Enterprise Beans
23. A Message-Driven Bean Example
24. Introduction to the Java Persistence API
25. Persistence in the Web Tier
26. Persistence in the EJB Tier
27. The Java Persistence Query Language
28. Introduction to Security in the Java EE Platform
29. Securing Java EE Applications
31. The Java Message Service API
32. Java EE Examples Using the JMS API
36. The Coffee Break Application
37. The Duke's Bank Application
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:
- Develop the web component code.
- Develop the web application deployment descriptor.
- Compile the web application components and helper classes referenced by the components.
- Optionally package the application into a deployable unit.
- Deploy the application into a web container.
- 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 calledhello1, in which the components are implemented by two JSP pages (tut-install/javaeetutorial5/examples/web/hello1/web/index.jsp and_tut-install_/javaeetutorial5/examples/web/hello1/web/response.jsp) and a servlet version called hello2, in which the components are implemented by two servlet classes (tut-install/javaeetutorial5/examples/web/hello2/src/servlets/GreetingServlet.java and tut-install/javaeetutorial5/examples/web/hello2/src/servlets/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 Chapter 2, Using the Tutorial Examples explains how to get the code for these examples.
After you install the tutorial bundle, the source code for the examples is in the following directories:
- tut-install/javaeetutorial5/examples/web/hello1/
- tut-install/javaeetutorial5/examples/web/hello2/
Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices