Introduction to dynamic elements, Attributes – Apple WebObjects 3.5 Tools And Techniques User Manual

Page 55

Advertising
background image

55

Introduction to Dynamic Elements

A dynamic element is an element whose exact HTML representation isn’t
determined until run time. Dynamic elements are represented in the
HTML template by the tag

<WEBOBJECT>

.

There are several types of dynamic elements that you can use in your
WebObjects applications. Some of them (such as dynamic forms or images)
have counterparts in standard HTML (

<FORM>

and

<IMG>

) and are always

translated into those counterparts at run time. Others (such as conditionals
and repetitions) are abstract dynamic elements, which don’t translate
directly into HTML but control the generation of other elements.

This chapter describes the techniques you use to add dynamic elements to
your components and to bind them to variables and methods in your code.
For more information on programming with dynamic elements, see
“Dynamic Elements” in the WebObjects Developer’s Guide. For details about
specific dynamic elements, see the Dynamic Elements Reference.

Attributes

Every dynamic element has one or more attributes. These attributes are
used for several purposes:

Some attributes are used to determine the exact HTML to be
generated when the element is displayed.

For example, the

value

attribute of a dynamic string element (WOString)

determines what text is generated in its place. At run time, WebObjects
replaces the WOString with the value of the variable or method that is
bound to it.

Other attributes are used to capture information provided by users. In
particular, form elements are used for this purpose.

For example, when the user submits a form, text typed by the user into
a dynamic text area (WOText) inside the form is assigned to the
variable bound to the

value

attribute of the text area.

Other attributes are used to specify actions to be taken when an event
occurs.

Advertising