|
XML Samples |
To improve performance and keep a strict separation between user interface design and business logic, the ASP uses business objects, which are ActiveX dlls, to perform all rules checking and database access. Keeping rules and database access logic in the business object and out of the ASP has another important benefit: the same business object can be re-used with a traditional VB form user interface.
A user interface (ASP or VB form) obtains business object property values using one of the follow two techniques:
- Property Gets obtain a single property value per call. Example: myCompany.Name
- A single function call, GetXML, returns all property values as an XML document string
The ASP interface uses the second interface, GetXML, to obtain property values and important meta-data in a single call. The meta-data includes the type of control, a label, data type, etc., is used by the XSL template when in processes the XML and transforms it into HTML. The following links show the XML generated by the Company business object for the list and detail form.
Error messages are also expressed as small XML documents and a separate XSL template transforms them into HTML.
XSL Templates
The ASP could contain statements that add individual browser controls for each business object property. This approach 'hard codes' the web interface design and requires many additional lines of ASP code. Any number of changes to a business object property (the name, different label, control type, list of permitted values, whether it is mandatory, etc.) would require a change to the ASP code.
The design approach used by the ASP Code Pattern avoids the overhead of high maintenance (and the related risk of induced bugs) by dynamically creating the web interface from meta-data provided by the business object. We can change the look and feel of the web interface by changing the business object's meta-data (only needs to be done once for all interfaces) or by changing the XSL template that renders the HTML from the XML.
ASP Code patterns are delivered with five XSL templates:
Developers can modify these templates to make the generated web interface match their tastes and standards.
ASP Pages
The following files are examples of ASP pages generated by Visible Developer for a Company Business Object:
|