Release 10.1A: OpenEdge Application Server:
Developing WebSpeed Applications

> ## 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:

> - Use the WebSpeed-defined SpeedScript output stream.

> - Define and use a new SpeedScript output stream.

> In general, it is better to use the WebSpeed-defined output stream to manage 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:

> - `&GLOBAL-DEFINE` `WEBSTREAM` `STREAM` `WebStream`

> - `&GLOBAL-DEFINE` `DISPLAY` `DISPLAY` `{&WEBSTREAM}`

> 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:

> - `DEFINE` `STREAM` statement — Defines a stream.

> - `OUTPUT` `TO` statement with the `“WEB"` option — Opens and directs the specified stream to your Web server.

> 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 OpenEdge Development: Progress 4GL Reference .

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