WebSpeed
Developer’s Guide


Directing DISPLAY Output

Like all SpeedScript output statements, the DISPLAY statement always directs output to a particular stream. In WebSpeed, this output stream must also be directed to the "WEB" device (your Web server). WebSpeed provides two ways to direct DISPLAY output to a stream:

In general, it is better to use the WebSpeed-defined output stream to maintain well-managed output to a Web page. The standard WebSpeed PUT statement directive ({&OUT}) uses the WebSpeed-defined output stream. Each output stream has its own buffer management. Because of this, if you output to more than one stream for a single Web request, the actual sequence of output to the Web page can be unpredictable. It might be different than the sequence specified by the order of output statements in your Web object.

Using the WebSpeed-defined Output Stream

WebSpeed provides two SpeedScript preprocessor definitions to help you use the WebSpeed-defined output stream:

These definitions appear in the install-path/src/web/method/cgidefs.i include file used by all Web objects. Thus, the two DISPLAY statements in the following example yield the same result:

FIND FIRST Customer.
DISPLAY {&WEBSTREAM} Name Phone.
{&DISPLAY} Name Phone. 

Use one of the forms shown in boldface to guarantee that all of your DISPLAY-formatted output appears in the Web page at the corresponding point where the code appears in your Web object.

Defining and Using a New Output Stream

To define and use a new output stream, WebSpeed provides two statements:

If you do not specify a stream in the OUTPUT TO statement, WebSpeed uses a default unnamed stream to send your output to the Web.

The following example defines a new stream and directs it to the Web:

FIND FIRST Customer.
DEFINE STREAM MyStream.
OUTPUT STREAM MyStream TO "WEB".
DISPLAY STREAM MyStream Name Phone. 

This statement opens the default unnamed stream and directs it to the Web:

FIND FIRST Customer
OUTPUT TO "WEB".
DISPLAY Name Phone. 

Both of these examples use the DISPLAY statement directly, sending its output to the Web. However, in the following example, there is no way to guarantee which will appear first in the Web page, the customer name or the customer address:

FIND FIRST Customer
OUTPUT TO "WEB".
DISPLAY Name Phone.
DISPLAY {&WEBSTREAM} Address City Postal-Code. 

For more information on the statements used in these examples, see the Progress Language Reference.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095