WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

Package examples.xml.attributes

This example demonstrates how to automatically parse a document using WebLogic Servlet request attributes.

See:
          Description

Class Summary
RequestHandler This class extends HandlerBase and is used to handle events created as an XML document is parsed by a SAX compliant parser.
 

Package examples.xml.attributes Description

This example demonstrates how to automatically parse a document using WebLogic Servlet request attributes.

In the example, a Client sends an XML file over HTTP to a JSP running on the WebLogic Server. The JSP uses the WebLogic Servlet request setAttribute method to parse the document using the SAX parser.

The example illustrates how to:

Additional Resources for examples.xml.attributes
Attribute.jsp The JSP that receives the XML data from the Java Client, parses it using the setAttribute method, and sends an acknowledgement back to the Client over HTTP.
employee.xml The XML file that is between the Java Client and the JSP over HTTP.

The following section describes how 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 the Java ant command. The Java ant command uses the build.xml file, located in the samples/examples/xml/attributes directory, to build the example. The Java Ant command performs the following steps:

    1. Compiles the Client.
    2. Compiles the RequestHandler class into WEB-INF/classes directory of the examples Web application.
    3. Copies the Attribute.jsp file into the examples Web application.
    4. Compiles the JSP Attribute.jsp under WEB-INF\classes of the examples Web application.

Run the Example

  1. Start the WebLogic Server in a new command shell.

  2. In your development shell, run the Client with the following command:
      $ java examples.xml.Client http://hostname:port/examplesWebApp/Attribute.jsp employee.xml
    where:
    hostname
    Host name of the WebLogic Server.
    port
    Port where the WebLogic Server is listening for connections (weblogic.system.ListenPort).

There's More...

Read more about:


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

Copyright © 2001 BEA Systems, Inc. All Rights Reserved.