      All Examples  All WebLogic Enterprise Connectivity Examples

WebLogic Enterprise Connectivity JSP University Example

package examples.wlec.jsp.university

- UniversityHelper

About This Example

This example demonstrates how to use WebLogic Enterprise Connectivity (WLEC) to access a WebLogic EnterpriseTM (WLE) CORBA object from a JavaServer Page (JSP) on WebLogic ServerTM (WLS). The example combines a WLS JSP and the WLE University example.

The following figure illustrates WLEC JSP University the example.

When you run the WLEC JSP University example, the following events occur:

1. At startup:

   1. WLS creates a WLEC Internet Inter-ORB Protocol (IIOP) connection pool for the WLE University domain.
   2. The University helper init method obtains a connection from the IIOP connection pool.

   The remaining steps are performed at run time.

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

3. The WLS JSPServlet finds the JSP file and uses the JSP compiler to compile the JSP file into a servlet class.

4. Acting as a WLE client, the servlet:

   1. Activates the connection to the University domain.
   2. Invokes the desired operation on the University CORBA object with the data that it received from the Internet client.

5. The University object performs the specified operation and returns the results to the JSP. The University object can perform the following operations:

   - Display a list of all the courses.
   - Display a list of courses based on a search string.
   - Display information about a course.
   - Register a student for a course.
   - Display a list of registered courses for a student.

6. The JSPServlet compiles the results into a dynamically generated HTML page and sends the page to the Internet client.

How To Use This Example

This section describes how to set up and run the JSP University example.

Prerequisites

Install and set up the following:

- WebLogic Server (WLS)
- Java Development Kit (JDK)
- WebLogic Enterprise (WLE)

See Platform Support for WebLogic Enterprise Connectivity for information about the supported versions for each product.

Setting Up the Example

1. Build and run the WLE University Transactions sample.

   See the University Transactions Sample Application in the WLE documentation:

   1. Go to CORBA Topics on the Web.
   2. Scroll down and click Sample Code.
   3. Click Transaction Sample under Overview of University Sample Applications.

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

2. Generate Java client stubs.

   Run the idltojava or m3idltojava compiler on the univt.idl file to generate Java client stubs.

   For information about the idltojava and m3idltojava compilers, see Developing WLE CORBA Applications in the WLE documentation:

   1. Go to CORBA Programming Topics on the Web.
   2. Click Developing WLE CORBA Applications.
   3. Click Step 2. Generate client stubs and skeletons.

   WLE and WLS provide the idltojava compiler. You must run the idltojava compiler on a computer with a Visual C++ development environment, because it runs the C precompiler on the .idl source.

3. Set up your WLS development environment as described in Setting Your Development Environment.

4. Copy the compiled WLE Transaction University client stubs to your WLS SERVER_CLASSES directory, where SERVER_CLASSES is an environment variable that you set when you set up your development environment:

   On Windows NT:

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

   On UNIX:

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

   where univ_dir is the location of the WLE University sample.

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

   On Windows NT:

           javac -d %SERVLET_CLASSES% *.java

   On UNIX:

           javac -d $SERVLET_CLASSES *.java

6. Copy the .jsp and .html files into your registered document root, which defaults to myserver\public_html.

7. Initialize an IIOP connection pool by modifying the weblogic.properties file.

   You can uncomment and edit the weblogic.CORBA.connectionPool.Univpool property in the weblogic.properties file. See Setting Up WebLogic Enterprise Connectivity.

Running the Example

1. Modify classpaths:

   - Add wleorb.jar to CLASSPATH in %WL_HOME%\setenv.cmd (NT) or $WL_HOME/setenv.sh (UNIX).

   - Add %WL_HOME%\lib\wleorb.jar (NT) or $WL_HOME/lib/wleorb.jar (UNIX) to JAVACLASSPATH.

     If you are going to start WLS by running startweblogic, set JAVACLASSPATH in the startweblogic.cmd file (NT) or the startweblogic.sh file (UNIX). Otherwise, set JAVACLASSPATH by means of another method such as the command line or the NT System Properties dialog.

   For information about setting classpaths for WLS, see Setting Up and Starting WebLogic Server.

2. Start WLS in your server shell.

3. Start a Web browser and enter the URL for UniversityForm.html. For example:

   http://localhost:7001/UniversityForm.html

4. On the HTML form:

   - Choose an operation.
   - Fill in the form.
   - Submit the form.

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

Related Documents

For information about WLS JSPs:

- Using WebLogic JSP
- JavaServer Pages Examples

For information about WLE CORBA objects:

- The WLE CORBA Programming Environment:

  1. Go to Getting Started on the Web.
  2. Click The WLE CORBA Programming Environment.

- Developing WLE CORBA Applications:

  1. Go to Getting Started on the Web.
  2. Click Developing WLE CORBA Applications.

- CORBA Topics on the Web.

For information about the WLE University example:

1. Go to CORBA Topics on the Web.
2. Scroll down and click Sample Code.
3. Click Transaction Sample under Overview of University Sample Applications.

See also Using WebLogic Enterprise Connectivity.

Copyright © 2000 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher. Last updated 4/25/00