Online documentation - WebsydianExpress v3.5 |
This section aims to give you an overview of the programs you need to develop in 2E to make a business process which can be plugged in to WebsydianExpress.
The following image gives an overview of the different components used. Each type of component is described in more detail below.
This structure is the one we have used in the example.
The WebsydianExpress Runtime is objects delivered with the installation. The the runtime receives the requests sent from the browser and calls the appropriate programs based on the request.
A ProcessEntryPoint will be called for the first request in a business process, for the rest of the requests an EventHandler will be called.
The ProcessEntryPoint is a function you must develop.
Exactly one ProcessEntryPoint function must be developed for each business process defined in WebsydianExpress.
The ProcessEntryPoint is called automatically by the runtime when a business process, which has the implementation name of the ProcessEntryPoint as Process ID is activated.
The name of the program object for the ProcessEntryPoint must be the same as the Process ID specified for the business process.
The ProcessEntryPoint can't be called with any parameters.
The ProcessEntryPoint just works as an interface between the runtime and the program handling the request.
In most cases the functionality of the ProcessEntryPoint will just be a call to the PageGenerator used to create the first page shown in the business process.
You can use the 2E function template W2E/ProcessEntryPoint when creating your own ProcessEntryPoint functions.
The EventHandlers are functions you must develop.
One EventHandler must be developed for each event you want to be able to activate in your business process.
The EventHandler function is called automatically when an event that has the object name of the function as event id is activated.
The Name of the EventHandler must correspond to the Event ID specified for the event when defining the template in the PageModeler.
The interface of the EventHandler must have one input field, a character field (Action) with length 1.
If the Action is "R" the program must set blank in the Return code and return to the calling program. This happens when the event is called the first time. It makes it possible for the runtime to register the event received as a valid event.
In all other cases - retrieve the values the user has entered (use the GetInput API) and the parameters set by the PageGenerator function (use the GetParm and ValidateParm APIs).
After retrieving the values entered by the user, you should validate them.
Please note that this is even more important in web applications than in e.g. 5250 applications. You cannot assume that you know anything about the data being retrieved.
For example: Before using a numerical field, you must check that it is actually a numeric value which has been entered, whereas this is normally ensured by the definitions in a 5250 display file.
After validating the values, you can use them in the program - e.g. for updating the database.
Finally, call the PageGenerator function that will send the reply page to the browser. Each EventHandler must ensure that a PageGenerator is called as the last step before the program is terminated.
You can use the 2E function template W2E/EventHandler when creating your own EventHandler functions.
The PageGenerators are functions you must develop.
One PageGenerator must be developed for each page you want to be able to show to the user.
No restrictions.
No restrictions.
Each PageGenerator is used to populate a specific template with values for the variables that has been defined for the template.
The PageGenerator can either get these values from input fields or by reading the database/making calculations etc.
After finding the values, the SetOutput/SetGridOutput APIs are used to make the values available for the function that creates the webpage by merging the template with the values set by the PageGenerator.
Please note that the values you write to the page using these APIs are just character strings. You must ensure that any formatting of these strings is done before you write them to the page.
The SetParm, SetGridParm APIs can be used to specify parameters for events specified in the template.
The Write Page API is called just before the PageGenerator terminates - this API merges the values specified in the program with the template, to create the webpage that is sent to the browser.
You can use the 2E function template W2E/PageGenerator when creating your own PageGenerator functions if the page should not contain a grid.
You can use the 2E function template W2E/GridPageGenerator when creating your own PageGenerator functions if the page can contain a grid.