Table of Contents Previous Section

WOGenericElement

Synopsis

WOGenericElement { elementName = aConstantString; ... };

Description

WOGenericElement provides a way for WebObjects to accommodate custom HTML elements that are empty, that is, that don't affect a range of text. Since the HTML language is evolving rapidly, it's convenient to have a way to dynamically generate elements which are not explicitly supported by WebObjects.

In HTML, an empty element (for example <HR> or <BR>) is represented by a single tag and so can't enclose any text or graphics. In contrast, a container element (for example, <A ... > ... </A>) has opening and closing tags that delimit the text or graphic affected by the element. (See the related element WOGenericContainer for information about the support of container elements.)

elementName
Name of the HTML element to generate. This name (for example "HR") will be used to generate the element's tag (<HR>).
elementName must be statically defined, that is, it must be a constant. It can't be something returned by a script method, for example. Please note that for elements with URL attributes, the URLs specified will appear as is in the HTML document.

This approach works for many elements, but has one limitation. Some HTML elements have an href attribute that associates the element with a URL. In WebObjects, the corresponding dynamic element generally has two mutually exclusive attributes, href and action, which make use of the HTML element's href attribute. (See WOHyperlink for an element that can have either an href or an action attribute.) The dynamic element's href attribute simply returns a URL, but action invokes a WebObjects method, which returns a URL. This overloading of the HTML href attribute is not supported by WOGenericElement. If your custom element requires this functionality, you will have to create your own subclass of WODynamicElement.

Examples

Support for unknown empty elements

Table of Contents Next Section