Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 6: Using the Web DataWindow [Table of Contents] Designing DataWindow objects

DataWindow Programmer's Guide

[-] Chapter 6: Using the Web DataWindow
[-] What the Web DataWindow is

What the Web DataWindow is

The Web DataWindow generates a DataWindow in HTML. It offers a thin-client solution that provides most of the data manipulation, presentation, and scripting capabilities of the PowerBuilder DataWindow without requiring any PowerBuilder DLLs or plugins on the Web client. The DataWindow that displays in the Web browser looks very much like the DataWindow you designed in the DataWindow painter.

HTML DataWindow

The Web DataWindow was formerly called the HTML DataWindow; both terms refer to the same technology.

The simplest way to use the Web DataWindow is to place a Web DataWindow DTC on a Web page template in a Web target. You can find more information about using the Web DataWindow DTC in the Working with Web and JSP Targets book.

How the Web DataWindow works

The Web DataWindow uses a component running in a transaction server (such as EAServer or MTS) cooperating with a dynamic page server (such as PowerDynamo, Microsoft Active Server Pages in IIS, or Java Server Pages in Tomcat) and communicating with a Web client via a Web server.

PowerDynamo Personal Web Server

PowerDynamo provides a Personal Web Server for use during development. In production, you can use any Web server that uses CGI, NSAPI, or ISAPI with the PowerDynamo dynamic page server.

A DataWindow COM component can also be called directly from PowerDynamo or ASP without a transaction server, but using a transaction server usually provides better performance because database connections and instances of the component can be pooled or cached.

Changing the component pooling property

During development, you may want to turn pooling off. Otherwise your transaction server will hold onto its connection to your DataWindow objects, preventing you from modifying them without stopping and restarting the server. For information on changing the pooling property of a component, see your server documentation.

When you have developed and deployed the pieces the Web DataWindow needs, here is what happens:

  1. In a Web browser, a user requests the URL for a page.

  2. The Web server passes the request to the page server, which locates the template for the requested page and executes server-side scripts in the template.

  3. The server-side scripts connect to the (transaction) server component, passing it information about the DataWindow and the database connection.

  4. Methods on the server component retrieve data required for the DataWindow from the database and translate the DataWindow definition, data, and state into HTML and JavaScript.

  5. The server component returns the HTML and JavaScript to the page server.

  6. The page server replaces the server-side script in the requested Web page with the generated HTML and JavaScript and returns the page to the Web browser via the Web server.

  7. The user interacts with the DataWindow--for example, requesting the next page or updating the data.

  8. The Web server passes the URL with added action parameters to the page server, and the cycle begins again.

Figure 6-1: How the Web DataWindow worksraster

The Web DataWindow server component and client control

The Web DataWindow has two main components: the server component and the client control.

Server component

The Web DataWindow server component retrieves data from a database and returns HTML and JavaScript that represent the data and the DataWindow object definition to the page server. The server component is a PowerBuilder custom class user object that uses a DataStore to handle retrieval and updates and is deployed as an EAServer or COM component. You can use the generic component provided with PowerBuilder or a custom component.

The generic EAServer component, HTMLGenerator90, is preinstalled in EAServer in a package named DataWindow. PowerBuilder also provides a generic COM component called PowerBuilder.HTMLDataWindow that you can register and use with IIS, MTS, or EAServer. The COM component is in the file PBDWR90.DLL. For information about using the COM component, see "Server configuration details".

Using an older version of the generic component

An earlier version of the generic component, HTMLGenerator, is also installed in the EAServer DataWindow package. Because EAServer supports multiple PowerBuilder VMs, you can continue to run older Web DataWindow applications that use this component.

The generic component has methods that you call in your Web page template to instantiate and configure the component. It also provides most of the methods available on the PowerBuilder DataWindow control. You should probably use the generic component when you are getting started with the Web DataWindow. Later you may want to build and deploy a custom component that uses the methods of the generic EAServer component interface or that uses only the methods you design for the component. See "Using a custom server component".

The following table displays all types of DataWindow server components:

Table 6-1: DataWindow server components and supported platforms

DataWindow server component

Platform (server component name)

Description

Generic

EAServer (DataWindow::HTMLGenerator90) or COM (PowerBuilder.HTMLDataWindow)

Prebuilt (Generic COM component is prebuilt ActiveX). No generation or compiling of stubs required.

Container (can include multiple DataWindow definitions)

EAServer (PackageName::ComponentName using generic DataWindow::HTMLGenerator90 interface)

Deploy with Web DW Container project wizard. Increases performance by reducing calls to server. No generation or compiling of stubs required.

Custom (hybrid)

EAServer (PackageName::ComponentName using generic DataWindow::HTMLGenerator90 interface)

Use to increase flexibility of generic component. Can build and deploy with PB object or project wizard. Generic methods remain available.

Custom (user-designed)

EAServer (PackageName::ComponentName) or COM (PackageName.ComponentName)

Potentially best for performance and scalability. Can use to avoid downloads of unneeded generic methods to client.

Client control

Embedding client-side scripts

The Web DataWindow client control is the JavaScript and HTML that is generated by the server component and embedded in the page returned to the Web client. Client-side scripts that you add to your Web page template and wrap in SCRIPT tags are embedded as JavaScript in the client control.

JavaScript caching

Some features available on the client control are optional: events, methods, data update and validation, and display formatting for newly-entered data. The size of the generated JavaScript increases as you add more client-side functionality. You can cache client-side methods in JavaScript files on your Web server, reducing the size of the HTML generated for Web DataWindow pages and improving performance on the client machine if the browser is configured to use cached files.

For information on enabling JavaScript caching, see "Using JavaScript caching for Web DataWindow methods" and the discussion of HTMLGen properties in the DataWindow Reference.

Using client-side events

Events that are triggered on the client control and several of the client control methods do not require the server component to reload the page, so processing on the client is typically much faster than processing performed on the server.

For more information about enabling features on the client, see "Setting HTML properties in the DataWindow painter" and "Controlling what HTML is generated ". For more about writing scripts, see "Writing client-side scripts".

For complete documentation of the events and methods available on the server component and the client control, see the DataWindow Reference or the PowerBuilder online Help.


Chapter 6: Using the Web DataWindow [Table of Contents] Designing DataWindow objects