|
Oracle9i Lite Developer's Guide for Web-to-Go
Release 5.0.2 Part No. A97671-01 |
|
This appendix contains Web-to-Go sample applications. Topics include:
Web-to-Go contains five sample programs that are installed with the Mobile Development Kit for Web-to-Go or the Mobile Server.
You can install the demos by running the batch file instdemo.bat. This batch file is located in:
<Oracle_Home>\Mobile\Server\samples
The command syntax is as follows:
instdemo.bat [SYSTEM_password] [repository_owner] [repository_password]
For example:
instdemo manager mobileadmin manager
You can install the demos by running the batch file sdkdemos.bat. This batch file is located in:
<Oracle_Home>\Mobile\sdk\wtgsdk\src\sdkdemos.bat
In the Mobile Development Kit for Web-to-Go, you can access the sample programs by accessing the following URL from your browser:
http://server:7070/
The browser displays the icons for the different sample programs. To launch a sample program, click the icon for the program.
When you install the Web-to-Go demos, the Mobile Server automatically creates the following sample users:
| User | Password |
|---|---|
| john | john |
| jack | jack |
| jane | jane |
The sample users can access the sample programs by logging on to the Mobile Server and clicking any of the sample application icons in the workspace.
Sample 1, Hello World is a servlet that returns a simple HTML page to the browser. It demonstrates the basic methods of HttpServlet and demonstrates the difference between the POST and GET methods.
The source code location varies depending on whether you installed the Mobile Server or the Mobile Development Kit for Web-to-Go.
| Installation Type | Source Code Location |
|---|---|
| Mobile Server | <Oracle_Home>\Mobile\Server\samples\sample1\src |
| Mobile Development Kit for Web-to-Go |
Java source can be found it:
<Oracle_Home>\Mobile\Sdk\wtgsdk\src\sample1\servlets Sample Classes can be found in: <Oracle_Home>\Mobile\Sdk\wtgsdk\root\sample1\servelets |
Sample 3, the Recording Tracker demonstrates how servlets can be used to maintain a database with recording information. The program allows users to search the database and enter recordings and tracks for a recording. Although the recordings are stored in the RECORDINGS table, users only see their own data when they access this table.
When a user goes offline, Web-to-Go automatically creates snapshots on the local client to hold a copy of the data. You can control which rows are replicated to the snapshot by adding a subquery to the snapshot definition. This enables Web-to-Go to synchronize specific rows for the user to the local client. In Sample 3, both John and Jack have access to the same data. Jane can only see her own data and no other user has access to it. For more information on setting up a snapshot subquery, see Oracle9i Lite Administration Guide.
Sample 3 contains the following database tables:
RECORDINGS
RECORDING TYPES
TRACKS
The database tables are displayed in the following entity-relationship diagram:
Sample 3 contains six different Java servlets. These servlets demonstrate two ways of generating HTML. The DisplayRecord servlet uses the oracle.html package to generate the entire HTML file. The DisplayMasterDetail, ListSearchResults, and SimpleList servlets generate HTML using the base class oracle.lite.web.html.TemplateParser and a static HTML template. In both cases, data is displayed in HTML using the DBTable class. Data changes are processed by the generic servlet ProcessForm which is part of the oracle.lite.web.html package. DeleteDetail and DeleteMasterDetail extend the class oracle.lite.web.html.DeleteRecords. These servlets execute a request and then redirect the browser to another URL.
The Recording Tracker program also illustrates the use of the ListResourceBundle class to manage resources for locale-specific strings. By isolating all text strings in a resource bundle, you can write programs that can easily be translated in other languages, or modified to add support for more languages. See SampleResources.java for more detailed information.
The source code location varies depending on whether you installed the Mobile Server or the Mobile Development Kit for Web-to-Go:
| Installation Type | Source Code Location |
|---|---|
| Mobile Server | <Oracle_Home>\Mobile\Server\samples\sample3\src |
| Mobile Development Kit for Web-to-Go |
Java source can be found it:
<Oracle_Home>\Mobile\Sdk\wtgsdk\src\sample3\servlets Sample Classes can be found in: <Oracle_Home>\Mobile\Sdk\wtgsdk\root\sample3\servelets |
Sample 3 contains the following application files:
| File | Description |
|---|---|
| EnterSearchCriteria.html | The Static HTML file. |
| sample3.gif | The Sample 3 icon that appears in the Web-to-Go workspace. |
| sample3.html | The start page for the application. |
| sample3.sql | The SQL Script that installs the sample3 database objects. |
| table.sql | The SQL script that creates the sample3 database tables. |
| insert.sql | The SQL script that populates the sample3 database tables with data. |
| drop.sql | The SQL script that drops the sample3 database tables. |
| SampeProgram3.java | The source code that contains static definitions for the Sample 3 application. |
| SampleResources.java | The source code for the String Resources used by the servlets. |
| DisplayMasterDetail.java |
The source code for the DisplayMasterDetail servlet.
|
| DisplayRecord.java |
The source code for the DisplayRecord servlet.
|
| SimpleList.java |
The source code for the SimpleList servlet.
|
| ListSearchResults.java |
The source code for the ListSearchResults servlet.
|
| DeleteDetail.java |
The source code for the DeleteDetail servlet.
|
| DeleteMasterDetail.java |
The source code for the DeleteMasterDetail servlet.
|
| DisplayMasterDetail.html |
The HTML template, used by the DisplayMasterDetail Servlet.
|
| ListSearchResults.html |
The HTML template, used by the ListSearchResults Servlet.
|
| SimpleList.html |
The HTML template, used by the SimpleList Servlet.
|
Sample 4, the Hello Applet illustrates how applets and servlets can communicate with each other. A Java applet calls a servlet running on the Mobile Server. The servlet responds by sending a string to the applet, which the applet then displays.
Sample 4 contains two servlets. The AppServlet servlet generates HTML that instructs the browser to launch the applet. This HTML includes applet parameters that contain the Mobile Server session information. The HelloServlet is called by the applet as part of the applet/servlet communication.
The source code location varies depending on whether you installed the Mobile Server or the Mobile Development Kit for Web-to-Go:
| Installation Type | Source Code Location |
|---|---|
| Mobile Server | <Oracle_Home>\Mobile\Server\samples\sample4\src |
| Mobile Development Kit for Web-to-Go |
Java source can be found it:
<Oracle_Home>\Mobile\Sdk\wtgsdk\src\sample4\servlets Sample Classes can be found in: <Oracle_Home>\Mobile\Sdk\wtgsdk\root\sample4\applets |
Sample 4 contains the following application files:
| File | Description |
|---|---|
| Sample4.gif | The Sample 4 icon that appears in the workspace. |
| Sample4.html | The start page for the application. |
| HelloApplet.java | The Java source code for the applet |
| AppServlet.java |
The Java source code for the AppServlet servlet.
|
| HelloServlet.java |
The Java source code for the HelloServlet servlet.
|
Sample 6, the Image Gallery demonstrates how to store binary data in the database without using the LONG datatype. When the sample program uploads images to the Mobile Server, it separates them into 255 byte chunks. As a result, you can store the images in a RAW datatype column.
The source code location varies depending on whether you installed the Mobile Server or the Mobile Development Kit for Web-to-Go:
| Installation Type | Source Code Location |
|---|---|
| Mobile Server | <Oracle_Home>\Mobile\Server\samples\sample6\src |
| Mobile Development Kit for Web-to-Go |
Java source can be found it:
<Oracle_Home>\Mobile\Sdk\wtgsdk\src\sample6\servlets Sample Classes can be found in: <Oracle_Home>\Mobile\Sdk\wtgsdk\root\sample6\servelets |
Sample 6 contains the following application files:
| File | Description |
|---|---|
| sample6.gif | Icon for the application, used in the Web-to-Go workspace. |
| loadImage.html | HTML form to upload an image. |
| DeleteImage.java |
Source code for the DeleteImage servlet.
|
| GetImage.java |
Source code for the GetImage servlet.
|
| Upload.java |
Source code for the Upload servlet.
|
| ImageList.java |
Source code for the ImageList servlet.
|
| ViewImage.java |
Source code for the ViewImage servlet.
|
| RawImage.java |
The Source code for the RawImage servlet.
|
| ImageList.html |
The HTML Template used by the ImageList servlet.
|
| ViewImage.html |
The HTML Template used by the ViewList servlet.
|
| sample6.sql | The SQL script that installs the sample6 database objects. |
| table.sql | The SQL script that creates the sample6 database tables. |
| drop.sql | The SQL script that drops the sample6 database tables. |
Sample 7, the Employee Data Applet, demonstrates how to use JDBC in an applet. The applet connects to the database using the oracle.lite.web.applet.AppletProxy class. This class automatically returns a database connection to the appropriate database depending on the user's connection mode. In online mode, the oracle.lite.web.applet.AppletProxy class returns a connection to the Oracle database. In offline mode, or when using the Mobile Development Kit for Web-to-Go, the class returns a connection to Oracle Lite.
The source code location varies depending on whether you installed the Mobile Server or the Mobile Development Kit for Web-to-Go:
| Installation Type | Source Code Location |
|---|---|
| Mobile Server | <Oracle_Home>\Mobile\Server\samples\sample7\src |
| Mobile Development Kit for Web-to-Go |
<Oracle_Home>\Mobile\Sdk\wtgsdk\src\sample7\src
<Oracle_Home>\Mobile\Sdk\wtgsdk\root\sample7\ |
Sample 7 contains the following application files:
| File | Description |
|---|---|
| sample7.gif | The application icon that appears in the workspace. |
| sample7.ahtml | The application start page. |
| AppApplet.java | The Java source code for the applet. |
| ErrorDialog.java | The Java source code for error dialog. |
| sample7.sql | The SQL Script to install the sample7 database objects. |
| table.sql | The SQL script that creates the sample7 database tables. |
| insert.sql | The SQL script that populates the sample7 database tables with data. |
| drop.sql | The SQL script that drops any old tables. |
|
![]() Copyright © 2002 Oracle Corporation All rights reserved |
|