Client-side java components, Deciding when to use client-side components – Apple WebObjects 3.5 User Manual

Page 37

Advertising
background image

Client-Side Java Components

37

elementName

:

elementType

{

attribute

=

value

;

attribute

=

value

};

Notice that the last attribute/value pair before a closing brace (}) does not
end with a semicolon (;).

As described in the previous section, value can be a constant, variable, or
method. It can also be a string of messages joined by a dot, similar to the
Java syntax for sending messages but without the parentheses. For
example:

application.upSince.description

Client-Side Java Components

Instead of using server-side dynamic elements, you can create Java applets
that run on the client. Typically, applets are downloaded to the client once
and then have virtually no communication with the server. This is not the
case with the client-side Java components provided with WebObjects.
While these applets run on the client, they continuously synchronize their
states with objects on the server. Client-side components can also trigger
action methods on the server. For this reason, they may be said to work in
virtually the same way as server-side dynamic elements.

To add a client-side component to your application, you drag it from the
palette provided in WebObjects Builder. For a list of the client-side Java
components that WebObjects provides, see the online book Client-Side
Applet Controls Reference
.

Deciding When to Use Client-Side Components

You should use client-side components whenever you want greater control
over the appearance of your application. In general, client-side components
have these advantages over server-side dynamic elements:

Client-side components define a state-synchronization phase that does
not reload the page.

As you learned in the first chapter, WebObjects applications are event
driven. The events that trigger actions are HTTP requests. A
WebObjects application receives an HTTP request from the client,
processes it, and returns a response page. That is, the only
communication that takes place between the client and the
WebObjects application on the server results in a page being redrawn
(or a new page being generated).

Advertising