All Examples

package examples.htmlkona

Class Index

about this package

This package contains several kinds of HTTP servlets that demonstrate:

Servlets you can run without a database

HelloWorld and HelloUniverse are very simple servlets that use htmlKona to display static data.

SimpleFrame and SimplePage also illustrate basic htmlKona page-building concepts.

InputWithForms shows you how to use forms to capture user input.

SimpleFormWithJavascript illustrates htmlKona forms, how to get user input, and how to use a scripting language with htmlKona for client-side processing.

ImageMap shows you how to set up an ImageMap with htmlKona.

AppletLoader demonstrates how to use htmlKona to create a servlet that loads an applet.

Servlets that require a database or some external data. To run these examples you'll need an Oracle instance DEMO with the table "emp". The defaults class is used by many of the servlets in this group. You can change database-specific properties once in the defaults class, recompile the directory, and not have to edit every file that uses a database connection.

SimpleDBLogin shows how to login to a database.

SimpleQueryDisplay uses dbKona and htmlKona to retrieve and display database data.

InsertUpdateDelete shows how to do three common database tasks and display the results.

DisplayByKeyDef uses a dbKona KeyDef object to update and delete database records.

InteractiveQuery shows how to take user input and use it to retrieve data for display.

DataSetToPage is an HTML page produced by reading page data stored in a database.

DataMerge and TableDataMerge illustrate how you can merge database data with a preexisting HTML file for display.

StoredProcResults shows how to use a stored procedure for processing and then display the results in an HTML page.

ImageDataDisplay, ImageByKeyDisplay, and AudioDataDisplay show how to read image and audio formats in from external sources for display in an HTML page.

how to use this package

  1. Check the defaults class for variables that you should change. This class is used by most of the examples in this directorty to make default database connections and set up servlet pages. You may need to change the connections it makes to your database.
  2. In a new command shell, run the setEnv.cmd script, then change to the ...\examples\htmlKona directory and compile all of the Java servlets using the command line:
     $ javac -d %SERVLET_CLASSES% *.java
  3. Register the ClasspathServlet in the weblogic.properties file to enable the WebLogic Server to deploy classes to applets.
  4. Place static pages such as "extdoc.html" and "formletter.html" in the document root of your WebLogic Server.
  5. For the AppletLoader example, obtain an applet (like the Blink from Sun), compile it, and place its class file in the SERVER_CLASSES directory on your WebLogic Server host.
  6. Register each servlet in the weblogic.properties file for the WebLogic Server, as shown in this example:
      weblogic.httpd.register.virtualName=fullPackageName
    where virtualName is the class name of the servlet and fullPackageName is the full package name.
    Here's an example:
      weblogic.httpd.register.AppletLoader=examples.htmlkona.AppletLoader
    Note that a property entry can't contain white spaces.
  7. Make sure your database is available. (The SQL for the "emp" table is in the examples/applet directory in the "emp.sql" file.)
  8. Start the WebLogic Server. If you're running your WebLogic Server on the same machine as you will use to load the servlets in a browser, make sure that the browser doesn't have a CLASSPATH set.
  9. Call each servlet from your browser, with a URL after the pattern:
      http://WebLogicURL:WebLogicPort/virtualName
    where WebLogicURL is the WebLogic Server's host, WebLogicPort is the port at which WebLogic is listening for login requests, and virtualName is the registered name of a servlet. For example:
      http://localhost:7001/HelloWorld

there's more . . .

We use several WebLogic APIs in these examples. Check out these Developers Guides for more about WebLogic's integrated development environment.