WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

Package examples.wlec.jsp.university

This example demonstrates how to use WebLogic Enterprise Connectivity to access a BEA Tuxedo CORBA object from a WebLogic JavaServer Page (JSP).

See:
          Description

JSP University Example Summary
displayDetailsServlet Illustrates how an Internet client uses a servlet to display course details provided by a BEA Tuxedo CORBA object.
displayOrRegisterServlet Illustrates how an Internet client uses a servlet to register for a course using information provided by a BEA Tuxedo CORBA object.
findCourseServlet Illustrates how an Internet client uses a servlet to find courses using information provided by a BEA Tuxedo CORBA object.
listAllServlet Illustrates how an Internet client uses a servlet to list all courses using information provided by a BEA Tuxedo CORBA object.
listRegisteredServlet Illustrates how an Internet client uses a servlet to list registered courses using information provided by a BEA Tuxedo CORBA object.
registerServlet Illustrates how an Internet client uses a servlet to register for a course using information provided by a BEA Tuxedo CORBA object.
University Demonstrates how a WebLogic JSP can connect to a BEA Tuxedo domain and invoke operations on CORBA objects in that domain.
 

Package wlec.jsp.university Description

This example demonstrates how to use WebLogic Enterprise Connectivity (WLEC) to access a BEA Tuxedo CORBA object from a WebLogic JSP. The JSP interacts with a COBRA object in the BEA Tuxedo Univeristy Transaction sample application.

When you run the WLEC JSP University example:

  1. WebLogic Server creates a WLEC connection pool for the BEA Tuxedo domain in which the Transactions sample application runs.

  2. The server application in the Transactions sample application uses the init method to obtain a connection from the WLEC connection pool.

  3. The Internet client sends a request, including an input string, to the WebLogic JSP. Before sending the request, the Internet client uses an HTML file to request and retrieve input data from the user.

  4. WebLogic Server finds the source file for the JSP and uses the JSP compiler to compile the JSP file into a servlet class.

  5. Acting as a BEA Tuxedo CORBA client, the servlet:

    1. Activates the connection to the BEA Tuxedo domain in which the Transaction sample application runs.
    2. Invokes the desired operation on the CORBA object with the data that it received from the Internet client.

  6. The CORBA object performs the specified operation and returns the results to the JSP. The CORBA object performs the following operations:

    1. Display a list of all the courses.
    2. Display a list of courses based on a search string.
    3. Display information about a course.
    4. Register a student for a course.
    5. Display a list of registered courses for a student.

  7. The servlet for the JSP compiles the results from the CORBA object into a dynamically-generated HTML page and sends the page to the Internet client.

The following section describes how to build and run the example:

  1. Prerequisites
  2. Build the Example
  3. Configure the Server
  4. Run the Example

Prerequisites

Install and configure the following:

Note: BEA Tuxedo version 8.0 combines the CORBA functionality previously found in the WebLogic Enterprise product with the ATMI functionality.

See BEA WebLogic Server Platform Support for information about the supported versions for WebLogic Server and WebLogic Enterprise Connectivity. For information about the supported platforms for BEA Tuxedo, see Installing the BEA Tuxedo System.

Build the Example

  1. Build and run the BEA Tuxedo Transaction sample application. For more information, see the description of the Transaction sample application.

    The build procedure for the Transaction sample application generates C++ client stubs and puts them in your working directory. Client stubs provide the programming interface for CORBA object operations.

    Note: You need to set the application password for the Transaction sample application to wlepassw.

  2. Generate Java client stubs by running the idltojava compiler on the univt.idl file. For more information about using the idltojava compiler in BEA Tuxedo, see Using the CORBA idltojava Compiler.

    You must run the idltojava compiler on a computer with a Visual C++ development environment, because the idltojava compiler runs the C++ precompiler on the OMG IDL source file.

  3. Set up your WLS development shell as described in Setting up your environment for building and running the examples.

  4. Modify your CLASSPATH as follows:

    1. Add %WL_HOME%\lib\wleorb.jar to the CLASSPATH in %WL_HOME%\config\examples\setExamplesEnv.cmd (Windows 2000) or $WL_HOME/config/examples/setExamplesEnv.sh (UNIX).

    2. Add %WL_HOME%\lib\wleorb.jar (Windows 2000) or $WL_HOME/lib/wleorb.jar (UNIX) to the CLASSPATH for the startup script.

    3. Add %WL_HOME%\lib\wlepool.jar (Window 2000) or $WL_HOME/lib/wlepool.jar (UNIX) to the CLASSPATH for the startup script.

    4. Add the RemoteObjectReference class to the CLASSPATH for the startup script. The RemoteObjectReference class is bundled in the wleclient.jar file in the %TUXDIR%\udataobj\java\jdk\wlej2eecl.jar.

    For information about setting the CLASSPATH for WebLogic Server, see Setting up your environment for building and running the examples.

  5. Copy the client stubs for the Transaction sample application to your WebLogic Server SERVER_CLASSES directory. SERVER_CLASSES is an environment variable that you set when you set up your development environment:

    On Windows 2000, use the following command to copy the files:

        mkdir %SERVER_CLASSES%\UniversityT
        COPY univ_dir\transactions\UniversityT\*.class %SERVER_CLASSES%\UniversityT

    On UNIX:, use the following command to copy the files:

        mkdir $SERVER_CLASSES/UniversityT
        cp univ_dir/transactions/UniversityT/*.class $SERVER_CLASSES/UniversityT

    Where univ_dir is the location of the built Transaction sample application.

  6. Compile UniversityHelper.java with one of the following commands.

    On Windows 2000:

        javac -d %EX_WEBAPP_CLASSES% *.java

    On UNIX:

        javac -d $EX_WEBAPP_CLASSES *.java

  7. Copy the .jsp and .html files located in the samples/examples/wlec/jsp/university directory in the WebLogic Server directory structure to the config/examples/applications/examplesWebApp directory. The config/examples/applications/examplesWebApp directory is the location of the public files for examplesWebApp.

Configure the Server

  1. Bring up the WebLogic Server Administration Console in a browser.

  2. Create a WLEC Connection Pool:

    1. Go to the Services->WLEC node in the left pane of the Administration Console.

    2. Click the Create a new WLEC Connection Pool link.

    3. Click the General tab.

    4. Create a new WLEC connection pool called Univpool.

    5. In the Primary Address attribute, enter the address of the IIOP Listener/Handler that will be used to establish a connection between the WLEC connection pool and the BEA Tuxedo domain in which the Transaction sample application runs.
      The format of the address is //hostname:port where hostname is the name of the machine on which BEA Tuxedo is running and port is the TCP port at which the IIOP Listener/Handler listens for incoming requests. The port value must be a number between 0 and 65535. The default value is 2468.

    6. In the Failover Address attribute, enter the address of an IIOP Listener/Hander that can be used if connections cannot be established with the IIOP Listener/Handler defined in the Primary Address attribute.
      The format of the address is //hostname:port where hostname is the name of the machine on which BEA Tuxedo is running and port is the TCP port at which the IIOP Listener/Handler listens for incoming requests. The port value must be a number between 0 and 65535. The default value is 2468.

      For more information about creating WLEC connection pools, see Managing Security.

  3. Click the Security tab to display the Application Password.

  4. Change the existing password to wlepassw.

  5. Click the Apply button.

  6. Select the Targets tab to display the Available and Chosen targets.

  7. Move the examplesServer from the Target column to the Chosen column.

  8. Click the Apply button.

Make sure that the examplesWebApp is deployed on your server.

Run the Example

  1. Start a web browser and enter the URL for UniversityForm.html.

    For example:

    http://localhost:7001/examplesWebApp/universityForm.html

  2. On the HTML form:

    1. Choose an operation.
    2. Fill in the form.
    3. Submit the form.

  3. Watch for the results. The results depend on the operation you chose.

There's More...

For more information about WebLogic JSPs, see:

For more information about BEA Tuxedo CORBA, see the BEA Tuxedo documentation.

For more information about the Transaction sample application, see the Guide to the CORBA University Sample Applications.

For more information about WLEC, see Using WebLogic Enterprise Connectivity.

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


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