Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

Implementing the Dispatcher Function



Below is a stepwise guide of how to implement the Event Dispatcher function in Websydian.  A number of variations and other possibilities of defining the Dispatcher function are described in the Other Uses section.

Defining the Dispatcher Function

Normally, only one application specific Event Dispatcher function is specified for a Websydian application.  This function must inherit from the EventDispather pattern, or from a pattern based on this.

Specify Call to Entry Page of Application

The Dispatcher function has a scoped function CallFirstPageGenerator which is called the first time the Dispatcher function is called directly from the web browser by a new web user.  This function in turn, should call the Page Generator of the first HTML page to be shown to the web user.  To the web user, this HTML page will be the Entry page of the Websydian application.

Therefore, a call must be added in the Edit point Call to first page to the Page Generator of the Entry Page.

Example:

CallFirstPageGen.gif (3838 bytes)

The CallFirstPageGenerator function scoped under the Dispatcher calls the Page Generator function of the Entry page of the web application.

Adding Calls-Triples for New Event Handler Functions

Whenever a new Event Handler function is defined in the application, the Event Handler must be 'declared' by defining a FNC calls FNC from the Dispatcher function to the new Event Handler function.  In a real-life application model there will be many such calls-triples.

Example:

Dispatcher function call triples

FNC Calls FNC triples for the Dispatcher function of an application.

This also means that the Dispatcher function needs to be regenerated and rebuilt whenever new Event Handlers are added to the application.  Otherwise, this will result in the event not being recognized.

Remember to assign an implementation name to all referenced Event Handler functions before generating and building the Dispatcher - or the Dispatcher function will not work at all.

Run the Web Application

A web application is started by specifying the URL address of the Dispatcher function, either as an HTML hyperlink in an HTML page or directly in the address bar of a Web browser.

Example:

Dispatcher function called from web browser

The web application is started typing the URL address at the address bar of a Web browser. The name webhost must be replaced with the root Web of the Web server.

Before any programs can be run from the Web browser, the Web server needs to be set up correctly.  Reference is made to the appropriate descriptions in the Websydian Installation and Operation pages.