[Top] [Prev] [Next] [Bottom] [Contents]

Projects: Printing from Server Applications

Using Templates

If you use HTML templates, you should generate your output calls in the Population callbacks. The reason is that Sapphire/Web Server Applications always print out the required:

Content-type: text/html\n\n

However, the <HTML> tag has not been output yet, but now your HTML template will probably contain that tag. This template is not "played" until all of your Main has executed (see SgeProcessInputStream in the Reference Manual) and all of the Data Objects for that activator function have executed. Only from within the Population Callbacks will the beginning of the HTML template have been "played". If you do want to send status or error information from outside of your Population Callback, look at the function SaPrintHtmlError in the Client API chapter of the Reference Manual.

HTML without Templates

If you are not using HTML templates, expect the following Sapphire/Web behavior. The CGI only outputs the Content-type header; it is your responsibility to produce all the HTML tags. Also, there is no "playing" of HTML files. Your Population Callbacks are called as each Data Object is executed. This is not a cause for concern, as SaPopulateMsgBox and SaPopulateTableMsgBox are potential callbacks. Callbacks can be added to an HTML-related module, as an additional source file for that project, as a library for the project, or added in a library for all projects. Look at the file SaHtmlC.c, in client/src of the Sapphire/Web distribution for examples and conventions. You can make use of lower-level examples using SaMakeHtmlString to print out information. See Chapter 9, "Population Callbacks", for an expanded discussion these callbacks.



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.