|
| WebLogic Server 6.0.0 Code Examples, BEA Systems, Inc. |
Package examples.wlec.jsp.university
This example demonstrates how to use WebLogic Enterprise Connectivity to access a WebLogic Enterprise CORBA object from a JavaServer Page(JSP) on WebLogic Server.
See:
Description
JSP University Example Summary |
displayDetailsServlet |
This JSP file illustrates how a University HTML client uses a servlet to display course details on the WebLogic Enterprise University CORBA objects. |
displayOrRegisterServlet |
This JSP file illustrates how a University HTML client uses a servlet
to register for a course on the WebLogic Enterprise University CORBA objects. |
findCourseServlet |
This JSP file illustrates how a University HTML client uses a servlet
to find courses on the WebLogic Enterprise University CORBA objects. |
listAllServlet |
This JSP file illustrates how a University HTML client uses a servlet
to list all courses on the WebLogic Enterprise University CORBA objects. |
listRegisteredServlet |
This JSP file illustrates how a University HTML client uses a servlet
to list registered courses on the WebLogic Enterprise University CORBA objects. |
registerServlet |
This JSP file illustrates how a University HTML client uses a servlet
to register for course on the WebLogic Enterprise University CORBA objects. |
University |
This example demonstrates how a WebLogic Servlet can connect to WebLogic Enterprise
and invoke operations on CORBA objects. |
Package wlec.jsp.university Description
This example demonstrates how to use WebLogic Enterprise Connectivity to access a WebLogic Enterprise CORBA object from a JavaServer Page on WebLogic Server. The example combines a WLS JSP and the WLE University example.
The following figure illustrates WLEC JSP University as the example.
When you run the WLEC JSP University example, the following events occur:
- At startup:
- WLS creates a WLEC Internet Inter-ORB Protocol (IIOP) connection pool for the WLE University domain.
- The University helper init method obtains a connection from the IIOP connection pool.
The remaining steps are performed at run time.
- 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.
- The WLS JSP finds the JSP file and uses the JSP compiler to compile the JSP file into a servlet class.
- Acting as a WLE client, the servlet:
- Activates the connection to the University domain.
- Invokes the desired operation on the University CORBA object with the data that it received from the Internet client.
- 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.
- The JSPServlet compiles the results 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:
- Prerequisites
- Build the Example
- Configure the Server
- Run the Example
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.
- Build and run the WLE University Transactions sample.
See the University Transactions Sample Application in the WLE documentation:
- Go to CORBA Topics on the Web.
- Scroll down and click Sample Code.
- 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.
Note: Make sure you set the Application password to wlepassw 8 characters long before you build the WLE University Transactions sample. As WebLogic Server University example does not support more than 8 character long password.
where:
- wlepassw
- Is the password you set in WebLogic Server University Example.
- 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:
- Go to CORBA Programming Topics on the Web.
- Click Developing WLE CORBA Applications.
- 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.
- Set up your WLS development shell as described in
Setting up your environment for building and running the examples.
- Modify classpaths:
- Add %WL_HOME%\lib\wleorb.jar to CLASSPATH in %WL_HOME%\config\examples\setExamplesEnv.cmd (NT) or $WL_HOME/config/examples/setExamplesEnv.sh (UNIX).
- Add %WL_HOME%\lib\wleorb.jar (NT) or $WL_HOME/lib/wleorb.jar (UNIX) to CLASSPATH in the start script.
If you are going to start WLS by running startExamplesServer, set CLASSPATH in the startExamplesServer.cmd file (NT) or the startExamplesServer.sh file (UNIX). Otherwise, set CLASSPATH by means of another method such as the command line or the NT System Properties dialog box.
Note: You need to add RemoteObjectReference class to your classpath in start script. This class is bundled under wlej2eecl.jar file in WLE 5.1 and under m3.jar file in WLE 5.0.
%TUXDIR%\udataobj\java\jdk\wlej2eecl.jar
where:
- %TUXDIR%
- Your WLE installation directory.
For information about setting classpaths for WLS, see Setting up your environment for building and running the examples.
- 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.
- Compile UniversityHelper.java with
one of the following commands.
On Windows NT:
javac -d %EX_WEBAPP_CLASSES% *.java
On UNIX:
javac -d $EX_WEBAPP_CLASSES *.java
- Copy the .jsp and .html files located in the samples/examples/wlec/jsp/university directory in your WebLogic Server installation
to the config/examples/applications/examplesWebApp directory in your WebLogic Server installation.
This directory is the location of the publically-available files of the examplesWebApp.
Configure the Server
- Initialize an IIOP connection pool:
- Start the server with the examples
configuration in a new command shell.
- Bring up the Administration Console in your browser.
- Click to expand the Services node in the left-hand pane.
- Click to expand the WLEC node in the left-hand pane.
- Select the Univpool node.
- Select the Configuration tab in the right-hand pane to display the General and Security tab.
- Select the General tab to display the Primary and Failover addresses.
- Change the Primary Addresses and Failover Addresses from [//wlehost:2468] to [//host:port].
where:
- host
- The name of the local machine.
- port
- The TCP port number at which the ISL process listens for incoming requests; it must be a number between 0 and 65535. The default value is 2468.
- Click the Apply button to save the assignment.
- Select the Security tab to display the Application Password.
- Change the existing password to wlepassw.
Note: Make sure that wlepassw is the same password which you set in the WLE University Transaction Sample.
- Click the Apply button to save the assignment.
-
Select the Targets tab in the right-hand pane to display the Available and Chosen
targets.
-
Move the examplesServer from the Target column to the Chosen column and click the Apply button to
save the assignment.
- Make sure that the examplesWebApp is deployed on your server.
Run the Example
- Start a web browser and enter the URL for UniversityForm.html.
For example:
http://localhost:7001/examplesWebApp/UniversityForm.html
- On the HTML form:
- Choose an operation.
- Fill in the form.
- Submit the form.
- Watch for the results. The results depend on the operation you chose.
There's More...
Read more about:
Copyright © 2000 BEA Systems, Inc. All rights reserved.