Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

Dispatcher Background



Dispatcher Function Called from Event HTML Form

For each event HTML form, the Dispatcher function is called when the event is selected (the push button is pressed).

Example of a generated HTML form:

<FORM ACTION="/WEBAPP/HUMANRES.EXE" METHOD="POST">
  <INPUT TYPE="HIDDEN" NAME="EventID" VALUE="WWaF">
  <P>Employee Name<INPUT TYPE="TEXT"
     NAME="AA85A" VALUE="/(AA85A)" SIZE="25"></P>
  <P>Department Code<INPUT TYPE="TEXT"
     NAME="AA7lA" VALUE="/(AA7lA)" SIZE="6"></P>
  <P><INPUT TYPE="SUBMIT"
     NAME="Confirm change" VALUE="Confirm change" ></P>
</FORM>

The Internet address (the URL) of the Websydian application Dispatcher program is specified by the ACTION attribute of the HTML form.  When the HTML Document Template is generated by a Document Template Generator function, the Internet address is taken from the AllFusion Plex default execution INI-file.

The identification of the event is passed to the Dispatcher function in the EventID field.  The event identification corresponds to the implementation name of the Event Handler function.  The Dispatcher function will then get the value of the EventID field and call the Event Handler function with the corresponding implementation name.

This is the reason why the FNC calls FNC triples must be declared from the Dispatcher to each of the Event Handler functions.  The Dispatcher function needs these declarations to generate the code that will determine if the received event identification matches the implementation name of an Event Handler function.

Passing Control from HTML Page to Event Handler

When a user triggers an event on an HTML page, Websydian will transfer control to the matching Event Handler function including the input parameters for the function.  In most situations, the Websydian developer does not need to know about the detailed flow of the program.  He just has to declare the input fields for the Event Handler function by populating the WebInput variable, and specify which new HTML page must be generated in response to the event.

This section explains in more detail how control and parameters are passed from the HTML page to an Event Handler function when the Web user triggers an event.  Knowledge of these details of Websydian may be of help in understanding and solving more complex Web Application problems.

The flow of control and parameters is illustrated in the figure below:

From HTML page to Event Handler

Control is transferred from HTML page to an Event Handler function.

The numbers in the figure have the following meaning:

  1. Each Event Handler function declared for the HTML page gives rise to an HTML form on the HTML page.  This structure is defined at development-time when the HTML Document Template is generated.  Each HTML form will contain a push button to capture the triggering of the event.
  2. A number of input fields are specified for each HTML form as declared in the WebInput variable of the Event Handler function.  Some of these fields may be hidden from the Web user.
  3. The Web user triggers an event on an event HTML form by clicking the push button and the form data is sent to the Web server.
  4. All parameters including the EventID field parameter are transferred as name/value pairs encoded as an URL parameter string.
  5. The Dispatcher function receives the request from the Web browser.  It scans the input for transferred name value pairs and stores these in an intermediate Internal Store.  All input parameters, regardless of type, are stored as character strings.
  6. Next, the Dispatcher reads the value of the EventID field from the Internal Store.
  7. The functions declared by the FNC calls FNC triples from the Dispatcher function are scanned to find a match between an implementation name and the value of the EventID field.  The matching Event Handler function is called.
  8. The Event Handler function receives the control.  For each field in its WebInput variable, the Event Handler function retrieves the value from the Internal Store, based on an implementation name match.  The value is unpacked from its character representation and stored as a regular AllFusion Plex value in the local field in WebInput.
  9. All input fields to the Event Handler function now reside in the local WebInput variable and can used as reference for further processing.  The developer specifies what action to be taken and what Page Generator function to be called.

For the AS400 Web server variant, the control and parameter passing is slightly more complex, since a number of components are placed in between the Web server and the Websydian application. Reference is made to the How AS400 Support Works page for more details.