9.3.3 Using Triggers to Generate Visual Web Components
LANSA for the Web provides you with a program, W3@P2600, which can be used to build input Visual Web components from data contained in a physical file on the Data/Application Server. There is also a LANSA built-in function (BIF) called WEB_BUILD_COMPONENT which can be used to call W3@P2600. The W3@P2600 program and WEB_BUILD_COMPONENT BIF can be used by LANSA functions to build components. By writing a LANSA function to build or rebuild a component, you can automate the maintenance of Web components.
It is recommended that you use the BIF rather than calling W3@P2600.
As an example, you will use the DEPTAB table from the Personnel Demonstration system in LANSA. The DEPTMENT field has a Visual Web component which is a drop down.
The parameters of the W3@P2600 program are:
- Name of the partition
- Name of the Web component
- Type of visualization
- Name of the physical file on the iSeries
- Name of the field in the physical file whose value will be used with the VALUE keyword in the generated HTML
- Name of the field in the physical file whose value will be displayed as the description in the Visual Web component
This program can be called from a trigger function on the DEPTAB file. This trigger is set up to execute when the contents of the file changes. For example, when the contents of the DEPTAB table changes, the trigger will execute and call W3@P2600 to rebuild the DEPTMENT Visual Web component. Using this approach, the Web application will always have the most recent information without waiting for developers to update components.
Note: The W3@P2600 program only supports physical files. This means that you cannot create a Web component using a logical file.