This sample demonstrates Java Servlets technology using the
Hotel Reservation System. This sample models a typical three-tier application.
A web browser acts as a client and invokes the servlet that executes in the
middle-tier and uses facilities provided by the HotelJDBC class to perform database
access to Oracle9i database, which is the server-tier. In other words,
we show how to write a servlet to do the same things that could be done with
the standalone Java application with the advantage that the application is now
Internet enabled.
Software Requirements
List the softwares required for configuring and running this
sample application.
Deploying and Running the application using
Oracle9i JDeveloper
This section describes the steps required for deploying and
running this application using Oracle9i JDeveloper.
Step 1:. Open the <SAMPLE_HOME>/HotelServlet/HotelServlet.jws
in Oracle9i JDeveloper . The workspace contains HotelServlet.jpr (project
file), Servlet files and other files.
Step 2: Create Database Server Connection
Select Database Server under the Connections Node.
Right click on Database Servers and select "New Connection".
In Step 1 of the wizard, Enter the Connection Name as
'Travel'.
In Step 2 of the wizard, Provide 'travel' as user name
and password for the travel schema. (by default travel).
In Step 3 of the wizard, Provide the appropriate database
connection information where travel schema is loaded.
In Step 4 of the wizard, Test the connection and Select
'Finish' button
Step 3: Right click HotelServlet.jpr and select
"Make HotelServlet.jpr". This compiles all the java classes in the project.
Step 4: Right click HotelServlet.jpr and select
"Run HotelServlet.jpr". This opens up the browser and runs the HotelServlet
Deploying and Running the application using
ANT
This section describes the steps required in deploying this
application to the Standalone OC4J using ANT Tool.
Step 1: SET
Environment Variables
Open the Command Prompt and Go to the <SAMPLE_HOME>/HotelSerlvet
directory
Ensure that <JAVA_HOME>/bin is in the PATH
Ensure that <ANT_HOME>/bin is in the PATH
Step 2: Build the EAR file
From <SAMPLE_HOME>/HotelServlet, execute ant
<SAMPLE_HOME>/HotelServlet>
ant
This will create the HotelServlet.ear
file.
Step 3: Having created a HotelServlet.ear file,
to deploy this application to Standalone OC4J, use the following command, from
<SAMPLE_HOME>/HotelServlet directory.
where, <host_name> is the machine on which OC4J is
running and <port> is Port to which the OC4J server listens to HTTP requests.
Default HTTP Listening port is 8888.
This section will provide a tabular listing of the sample
application files, along with their respective directory locations and a description
of their roles in the overall scheme of the application.
Directory
File
Description
HotelServlet
build.xml
This XML file is used by ANT to create the application
ear file