Download PDF Home History |  | API Search Feedback FAQ

> ## Getting Started with Web Applications

> A Web application is a dynamic extension of a Web or application server. There are two types of Web applications:

> - Presentation-oriented: A presentation-oriented Web application generates interactive Web pages containing various types of markup language (HTML, XML, and so on) and dynamic content in response to requests. Chapters 11 through 22 cover how to develop presentation-oriented Web applications.
> - Service-oriented: A service-oriented Web application implements the endpoint of a Web service. Presentation-oriented applications are often clients of service-oriented Web applications. Chapters 8 and 9 cover how to develop service-oriented Web applications.

> In the Java 2 platform, Web components provide the dynamic extension capabilities for a Web server. Web components are either Java servlets, JSP pages, or Web service endpoints. The interaction between a Web client and a Web application is illustrated in Figure 3-1. The client sends an HTTP request to the Web server. A Web server that implements Java Servlet and JavaServer Pages technology converts the request into an `HTTPServletRequest` object. This object is delivered to a Web component, which can interact with JavaBeans components or a database to generate dynamic content. The Web component can then generate an `HTTPServletResponse` or it can pass the request to another Web component. Eventually a Web component generates a `HTTPServletResponse` object. The Web server converts this object to an HTTP response and returns it to the client.

> Figure 3-1 Java Web Application Request Handling

> Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content. Although servlets and JSP pages can be used interchangeably, each has its own strengths. Servlets are best suited for service-oriented applications (Web service endpoints are implemented as servlets) and the control functions of a presentation-oriented application, such as dispatching requests and handling nontextual data. JSP pages are more appropriate for generating text-based markup such as HTML, Scalable Vector Graphics (SVG), Wireless Markup Language (WML), and XML.

> Since the introduction of Java Servlet and JSP technology, additional Java technologies and frameworks for building interactive Web applications have been developed. These technologies and their relationships are illustrated in Figure 3-2.

> Figure 3-2 Java Web Application Technologies

> Notice that Java Servlet technology is the foundation of all the Web application technologies, so you should familiarize yourself with the material in Chapter 11 even if you do not intend to write servlets. Each technology adds a level of abstraction that makes Web application prototyping and development faster and the Web applications themselves more maintainable, scalable, and robust.

> Web components are supported by the services of a runtime platform called a Web container. A 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 email.

> Certain aspects of Web application behavior can be configured when the application is installed, or deployed, to the Web container. The configuration information is maintained in a text file in XML format called a Web application deployment descriptor (DD). A DD must conform to the schema described in the Java Servlet Specification.

> Most Web applications use the HTTP protocol, and support for HTTP is a major aspect of Web components. For a brief summary of HTTP protocol features see Appendix C.

> This chapter gives a brief overview of the activities involved in developing Web applications. First we summarize the Web application life cycle. Then we describe how to package and deploy very simple Web applications on the Sun Java System Application Server Platform Edition 8. We move on to configuring Web applications and discuss how to specify the most commonly used configuration parameters. We then introduce an example--Duke's Bookstore--that we use to illustrate all the J2EE Web-tier technologies and we describe how to set up the shared components of this example. Finally we discuss how to access databases from Web applications and set up the database resources needed to run Duke's Bookstore.

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.