WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

Package examples.webapp.cookie

This example demonstrates the Web Application Archive (WAR) format and how a Web Application is deployed and accessed from a browser client.

See:
          Description

Cookie Example File Summary
web.xml Web Application deployment descriptor. The descriptor configures a servlet, a welcome file (.html), and an error page (.jsp).
error.jsp Error page for the cookie Web Application.
hello.html Welcome page for the cookie Web Application.
cookie.jpg Image file displayed in by the CookieCounter servlet
CookieCounter.java The CookieCounter servlet from the examples.servlets package is compiled and packaged into the WAR file created in this example.
 

Package examples.webapp.cookie Description

This example demonstrates the Web Application Archive (WAR) format and how a Web Application is deployed and accessed from a browser client. This example demonstrates how servlets and served files (.html, .jsp, and image files) must be packaged when deployed in a WAR file.

Perform the following steps to build and run the example:

  1. Build the example
  2. Run the example

Build the Example

  1. Set up your development shell as described in Setting up your environment.

  2. Compile the example by executing an ant build script or a command.
For your convenience, a build script is included in the samples\examples\webapp\cookie directory that compiles the servlet, packages the Web Application into a WAR file, and places the WAR file into the config\examples\applications directory where it is automatically deployed.

Run the build script using the following Java ant command at the prompt in the  samples\examples\webapp\cookie directory:

$ ant

 The build script performs the following steps (you should view the build script to determine the exact commands used):

  1. Creates a staging directory named build for the Web Application. This includes a WEB-INF subdirectory which is used to store the Web Application deployment descriptor, web.xml, and the classes required by the Web Application.
  2. Copies the deployment descriptor and serves files into the appropriate locations in the staging directory.
  3. Compiles the CookieCounter servlet from the examples.servlets package into the WEB-INF\classes subdirectory of the staging directory.
  4. Creates a WAR file using the jar command and saves the WAR file into the config\examples\applications directory.

Run the Example

  1. Start WebLogic Server with the examples configuration.

  2. Load the cookie Web Application into a browser using a URL such as:
      http://hostname:port/cookie
    where:
    hostname
    Host name of the WebLogic Server
    port
    Port where the WebLogic Server is listening for connections
  3. Follow the "Click here" link.

There's More...


Documentation is available at
http://e-docs.bea.com/wls/docs70/

Copyright © 2002 BEA Systems, Inc. All rights reserved.