Integrating the DataWindow on your page
The Web/JSP
DataWindow Page wizard helps you to integrate Web DataWindow controls
into new pages for your Web application. For existing pages, you
insert a Web DataWindow DTC, then set its properties.
Inserting
a Web DataWindow DTC to a Web page involves:
- Selecting the source for
a DataWindow object - Selecting a database profile
- Selecting an HTML generator
It also typically involves:
- Binding data to DataWindow
retrieval arguments - Defining hyperlinks on objects
in a DataWindow - Changing presentation details stored in the DataWindow
definition
(see “DataWindow presentation
styles and properties settings”) - Scripting client or server-side events on the DataWindow
(see “Choosing an object or event
for scripting”)
Selecting the source for a DataWindow object
You
create a DataWindow object in PowerBuilder or InfoMaker.
If you use a PowerBuilder Library (PBL), report (PSR), or
an exported source (SRD) file as the source for your Web DataWindow,
you must make sure that the file is available to the application
(page) server. This means either that the file containing the DataWindow
definition must be deployed to the system path of the server, or
you must specify an absolute path to the file on the DataWindow
page of the Sybase Web DataWindow DTC dialog box.
If you specify an absolute path for a DataWindow definition,
make sure that the path is the same on the development machine and
the machine that hosts the server component.
If you use a Web DataWindow Container component as the source
for a Web DataWindow, you must build the project you create with
the Web DataWindow Container Component wizard and deploy the component
directly to the component server for your Web application.
Selecting a database profile
When you build your DataWindow, you must define a data source
connection. In PowerBuilder,
you must also set up a database profile to define access to the data
source connection. Database profiles that you define in PowerBuilder automatically
populate the Database Connection drop-down list on the Connection
page of the Sybase Web DataWindow DTC Properties dialog box. For
information on defining a database profile, see Connecting
To Your Database
.
You must make sure that the application server can use the
database connection defined in your database profile to connect
to the data source for the DataWindow object. See your server documentation
for the types of connection and the connection options it supports.
Connection not needed for PSR file You do not need–and cannot select–a database
connection for a DataWindow definition that you get from a PSR file.
If you use a Web DataWindow Container component, you should
make sure that the database connection you define on your local
machine is also defined as a connection cache on the EAServer machine
to which you deploy the component. If you are using a JDBC connection
and do not define a connection cache, you will get a runtime error
when you try to use a DataWindow definition from the container component.
With a Web DataWindow Container component, you also have the
option of overriding the database connection defined in the component.
Selecting an HTML generator
By default, a DataWindow that you add to a Web page in the
HTML Editor uses the HTMLGenerator90 component on an EAServer machine
to generate the DataWindow as HTML. You must first define a profile
for the EAServer machine you want to use.
For information on defining an EAServer profile, see “Accessing components”.
From the Sybase Web DataWindow DTC Properties dialog box,
you can select a custom component that implements the default generator,
or a Web DataWindow Container component that you want to use to
generate the HTML.
Using the Web DataWindow Container component If you select a Web DataWindow Container component as the
source for your DataWindow, you cannot select a different component
to generate the HTML.
You cannot select an HTML generator component on MTS from
the Web DataWindow DTC. If, however, you are using such a component
to generate HTML for a DataWindow, you must select the Use MTS radio
button on the HTML Generator page of the Sybase Web DataWindow DTC
Properties dialog box.
Easy integration into Web pages
You can use the Web/JSP DataWindow Page wizard to
create a new Web page with a DataWindow on it. For existing pages,
you add a DataWindow to your page using the Web Target toolbar or
the Insert>Form Field menu in Page view or Source view
of the HTML editor. You can also drag and drop a DataWindow (or
a Web DataWindow Container component) onto a Web page in the HTML editor.
If you want your page to access a Web DataWindow component
on EAServer, both the wizard and the property pages give you quick
access to a list of the components available.
Adding a Web DataWindow DTC to a page
To create a new page with a Web DataWindow DTC:
-
In an open Web Target workspace, select
File>New from the menu bar. - Click the Web tab of the New dialog box.
-
Double-click the Web/JSP DataWindow Page
wizard icon. -
Follow the instructions in the wizard to complete
the entries required.
The new HTML page is not 4GL-enabled If you want to enable 4GL processing for the new page, you
need to select the Enable 4GL Web Server Side Event Model check
box in the Page Properties dialog box for the page after you create
it.
To insert a new Web DataWindow DTC in an existing
HTML page:
-
In Page view or Source view of the HTML
editor, put the insertion point where you want the control to appear. -
Select Insert>Form Field>DataWindow
from the menu bar.or
Click the DataWindow
button on the Insert toolbar.
Drag and drop You can also drag the Sybase Web DataWindow DTC control from
the Components tab of the System Tree to an open page in the HTML
editor Page view or Source view. You can find the control under
the ActiveX Controls>Web Design-Time Controls branch on
the Components tab.The Sybase Web DataWindow DTC Properties dialog box displays.
-
Specify the properties of the control on the pages
of the Sybase Web DataWindow DTC Properties dialog box.You must provide the following information for the control:
- The name
of a file (PBL, PSR, SRD) or a Web DataWindow Container component - The name of a DataWindow object
- The name of a predefined data
source connection–not needed (and not possible) for a DataWindow
object in a PSR file - For EAServer components, the name of
the server and the name of the Web DataWindow server component:
either the DataWindow HTML Generator component, or a customized
Web DataWindow server component (including a Web DataWindow Container
component) that implements the HTMLGenerator90 interface
See the DataWindow Programmer’s Guide
for
information on creating a custom DataWindow server component. The
custom component must implement the HTMLGenerator90 interface for you
to use it in the DTC. - The name
-
Do one of the following:
- In Page view Click OK in the Sybase Web DataWindow
DTC Properties dialog box. - In Source view Click OK in the Sybase Web DataWindow DTC Properties
dialog box and then click OK to close the Edit Design Time Control
dialog box.
Using the Edit Design Time Control dialog box You can do any of the following in the Edit Design Time Control dialog
box:- Click OK to insert
the control in the page. - Click Cancel to cancel the insert
operation. - Click Properties to redisplay
the Sybase Web DataWindow DTC Properties dialog box.
- Click OK to insert
- In Page view Click OK in the Sybase Web DataWindow
Editing an existing Web DataWindow DTC
To edit a Web DataWindow DTC in Page view:
-
Right-click
the DTC object in Page view and select Sybase Web DataWindow DTC
Properties from the pop-up menu.The Sybase Web DataWindow DTC Properties dialog box displays.
-
Make the changes you want to the property settings
and click OK.
To edit a Web DataWindow DTC in Source view:
-
Right-click the METADATA or OBJECT tag
for the DataWindow source code and select Properties from the pop-up
menu.A representation of the control displays in the Edit Design
Time Control dialog box, and the Sybase Web DataWindow DTC Properties
dialog box displays with the current settings for this control. -
Make the changes you want to the property settings
and click OK. -
Click OK to close the Edit Design Time Control
dialog box.
What you see in Page view
The labels from the header band of the DataWindow object that
you select in the Web DataWindow Properties dialog box (or in the
Web DataWindow wizard) display in Page view. If you did not specify
a DataWindow object, you will see only an empty box–with
a title based on the default DataWindow control name to represent
the Web DataWindow.
If you saved data in your DataWindow object, you can also
see data in Page view–unless you use a Web DataWindow Container
component as the source for your DataWindow object.

When you deploy the page, the generated source HTML and script
is passed to the server.
What you see in Source view
When you insert
a Web DataWindow DTC in a Web page, the following text is added
to the page source between two METADATA comments:
- An <OBJECT> element
that embeds the Web DataWindow DTC ActiveX in the page. The control
provides the information to manage the server component that generates
the client control. The OBJECT element has parameters that keep
track of various kinds of information about the DTC definition.
For example, the OBJECT SourceFileName parameter specifies
the PBL, PSR, or SRD file that contains the DataWindow object definition.
This value is set to an empty string if a Web DataWindow Container
component is the DataWindow source. - Server script generated by the DTC that
provides logic for accessing the Web DataWindow server component.
To allow you to target multiple application servers from the same
source page, platform-independent code is generated that takes advantage
of the capabilities of the Web Target object model.
The OBJECT element in the METADATA comment is required only
when you are authoring the page; it is not needed at execution time.
However, when the application server processes the page, it executes
the generated server script on the page and returns the resulting
HTML to the Web browser.
Working with the generated text Typically, you do not modify any of the text generated for
the Web DataWindow DTC. Changes you
make are lost the next time you modify the properties of the control
and regenerate the text.
What you see in a non-4GL Web page
You can see the generated source for your page in the Source
view of the HTML editor. The following example shows the OBJECT
element (and some of the PARAM tags) added to the Source view for
a Web DataWindow DTC in a non-4GL page. They are wrapped in a METADATA
comment:

The code for the DTC includes source and connection information.
It calls the Generate method on the server component
inside a server script immediately following the closing OBJECT
tag and just before the closing METADATA comment:

What you see in a 4GL Web page
When placed on a 4GL Web page, the Web DataWindow DTC becomes
an object of type PSWebDataWindowClass (an extension to the Web
Target object model) with its own server-side methods and events.
These are listed under the Web Target object model node on the Language
tab of the System Tree.
The OBJECT element on a 4GL Web page includes a special CREATE attribute
that sets the source and connection information for the DataWindow object
(similar to the code that is generated inside a server script on
a non-4GL page):

The server script generated on a 4GL page calls only the Generate method
on the server component:

On the Page view of the Web Target HTML Editor, you can code
server-side events (in 4GL Web mode only) from the integrated Script
editor. After you select a Web DataWindow control in the first drop-down
list in the Script editor, you can select a server-side event in
the second drop-down list. Server-side events display in
blue, and client-side events display in black.
Using the Web Target object model
The Sybase Web DataWindow DTC uses the
following classes of the Web Target object model to set up the database
and component server connections:
- PSConnectionParmsClass
- PSDataWindowClass
- PSDataWindowSourceClass
- PSJaguarConnection
- PSNamedConnectionParmsClass (not supported in JSP
targets)
For more information, see the Web and JSP Target
Reference
.