Both XML Object Language and XPRESS provide ways of representing lists in forms.
You use the <list> element when representing lists in XPRESS. The contents of the <list> element can be any XPRESS expression.
Use only the <list> XPRESS element in forms if the list must contain calculated elements. Using the <list> element can slow the execution of the form in which it is included. This degradation in performance is typically not noticeable unless the list contains many elements. It is permissible and common for forms to use <list>.
The following example uses the <s> string constants in the XPRESS list, but you can also use the <invoke> or <concat> elements to dynamically build the list elements.
<list> <s>cat</s> <s>dog</s> </list>
The XML Object language uses the <List> element to represent lists. The contents of the <List> element can be only other XML Objects. In the following example, the content of the <List> element are <String> elements.
<List> <String>cat</String> <String>dog</String> </List>
The following form incorporates fields containing lists defined by both XML Object syntax and XPRESS.
<Form> <Field name=’department’> <Display class=’Select’> <Property name=’allowedValues’> <List> <String>Engineering</String> <String>Marketing</String> <String>Sales</String> </List> </Property> </Display> </Field> <Field name=’department2’> <Display class=’Select’> <Property name=’allowedValues’> <expression> <list> <s>Engineering</s> <s>Marketing</s> <s>Sales</s> </list> </expression> </Property> </Display> </Field> </Form>
The allowedValues list in the department field is defined as a static list built with <List>. No matter how many times this form is used, only one list is created. In contrast, the allowedValues list in the department2 field is defined with a <list> expression. A new list is created every time this form is used.
You can use either the XML Object syntax or XPRESS to dynamically construct Map objects. Using the XPRESS <map> element is similar to using the XML Object language <Map> and <MapEntry> elements. These elements differ in that the contents of <map> can be calculated using expressions. In contrast, the <Map> element can only define static maps.
Maps are sometimes used as arguments to methods that are called with an <invoke> expression. For example, certain methods in the FormUtil class require maps as arguments.
The contents of the XPRESS <map> element are pairs of name/value expressions. The even-numbered expressions define map keys, and odd-numbered expressions define map values. If any key expression evaluates to null, the entry is ignored.
You can use the XPRESS <map> element to dynamically construct java.util.HashMap objects:
<map> <s>name</s> <s>Jeff</s> <s>phone</s> <s>338-1818</s> </map>
You can use XML Object syntax to define map objects as follows:
<Map> <MapEntry key=’name’ value=’Jeff’/> <MapEntry key=’phone’ value=’338-1818’/> </Map>