Dynamic hyperlinks – Apple WebObjects 3.5 Tools And Techniques User Manual

Page 77

Advertising
background image

Creating Other WebObjects

77

time. A WOString is abstract in that it doesn’t represent any specific
element, but it can be contained in any other HTML element that can
contain text.

WebObjects Builder provides a shortcut for binding the

value

attribute of a

WOString, since it is by far the most common attribute you bind.

Instead of dragging to one of the icons, drag to the center binding box. The
binding appears directly in the box, and the Inspector doesn’t come to the
front.

Dynamic Hyperlinks

Dynamic hyperlinks (WOHyperlink) allow you to specify the link’s
destination at run time rather than at compile time. There are several ways
to do this:

You can specify the name of a page in your application as the destination
of the link. To do this, bind the name to the WOHyperlink’s

pageName

attribute. This is useful since pages in a WebObjects application don’t
have predictable URLs that you can specify in an HTML hyperlink.

You can specify an action to be performed when the hyperlink is clicked
by binding WOHyperlink’s

action

attribute to an action method in your

code. This method can perform any sort of action, as well as returning a
page as the destination.

You can also specify a URL as the destination by binding to the

href

attribute.

To create a dynamic hyperlink:

1. Click

in the toolbar.

2. Replace the word

Hyperlink

with the text of the link.

3. Create the element’s bindings.

To learn how to create a static hyperlink, see “Creating Hyperlinks”.

Drag to here to bind

value

attribute directly.

Advertising