Oracle on the Web Part 1 - Exploring Oracle's HTTP Server - Page 2
April 13, 2005
How to switch the home or default page on your HTTP server
The URL (or URI, depending on your preference for nuances) used earlier only had the host name and port number. Isn't there supposed to be a default or home page? There usually is, and in fact, you want to force users to a home page for two good reasons. First and foremost has to do with security, and the second has to do with control. By control, I mean it is your Web site and your show, so start users off with the main page and then let them navigate from there.
There is a default page and it is specified in a configuration file named httpd.conf in the conf folder. The default page is index.html and this file is found in the htdocs directory. So entering just the host_name:port address or host_name:port/index (or index.html) will result in the same page being displayed. Just for grins and to show how easy it is to change the home page, let's edit the httpd.conf file and set the default page to index.html.fr (all files will be in the htdocs folder). There is an English version (as well as quite a few other foreign language versions) to choose from.
Around line 415, change index.html to index.html.fr.
Stop and restart the HTTP server for the change to take effect, and then refresh the page.
If you have a home network (and this works in your office as well, and it works just as well on UNIX), you can set up your own intranet. Using a second computer (although done on my main computer using remote desktop services), I am able to connect to my HTTP server as shown below. The only difference is that I had to use a "real" IP address or host name instead of localhost.
Let's look at some of the demos which come with OHS. Don't forget to reset your default page to index.html; otherwise you'll have add index.html to the URL to get back to the demo welcome page.
The JServ demo is nothing more than a page showing the following:
The JSP pages/demos have more to offer. Navigate back to the home page and click on the JSP demo's link.
The Basic demo contains several small samples you can view or interact with. The SQL Access demo is of particular interest to us because here is where we get to connect to an Oracle database. Note that you have to provide some connectivity information before using these examples. The jdbc:oracle:thin:@host:port:SID connect identifier is found in other Web servers (e.g., in the web.xml file for Tomcat), so becoming familiar with that syntax will come in handy down the road.
Using the sample5.jsp demo (under the SQL Tags category) and inserting the data several times results in: