The Internet Encyclopedia (Volume 3)

(coco) #1

P1: IML


Cassel WL040/Bidgoli-Vol III-Ch-65 September 15, 2003 8:52 Char Count= 0


810 WIRELESSAPPLICATIONPROTOCOL(WAP)

WML Tasks
Forward and Backward Navigation
A WAP application keeps track of the sequence of cards
displayed and also of how each card was reached. As a
user views the cards in some order by selecting from lists
or choosing to progress to the next card, the application
records the identities of visited cards on a stack. Going
back to the previous card consists of popping the stack.
When the user goes back, there is no option to return to
the card most recently viewed. In other words, the his-
tory mechanism is strictly a stack. Once popped from the
stack, the historical reference is gone. The WML history
structure stores only the identity and reference informa-
tion for each card viewed; it does not store the content
of the card. Thus, if a variable displayed on a card has
changed value since the card was seen, revisiting the card
will show the variable with its current value. On the other
hand, if a card was first obtained by an HTTP post method
the card will be refetched using the same values as in the
original fetch. In summary, local variable changes will be
reflected when old cards are redisplayed; if a card is ob-
tained by an HTTP POST, revisiting the card will cause
the original fetch operation to be repeated, using the same
values.
Four tasks define the WML navigational behavior:go,
prev, noop, refresh. Of these,goandprevprovide
forward and backward navigation. Thegotask causes a
referenced card to be loaded and displayed. Theprevtask
causes the history stack to be popped. The top card on the
history stack is identified and displayed. (Results if there
is no history are not defined in the standard.)

Do Nothing and Update Context
Thenooptask causes no processing. Therefreshtask
causes the current card to be redisplayed using the current
variable state and any processing under way stops. If the
current card contains a timer, the timer is started on the
refreshtask.
If any task fails to complete, the current card remains
in view. No changes are made to the browser context and
no intrinsic event bindings are executed.

WML Events
Two types of events are included in the WML specifica-
tion: intrinsic events and extrinsic events. Intrinsic events
are internally generated; extrinsic events originate with
an external source. The WML specification does not de-
fine any extrinsic events. Four intrinsic events are defined:
timer, enterforward, enterbackward,andpick.
Thetimerevent occurs when a timer goes off. A timer
element measures elapsed time in tenths of a second. (A
given device may be more or less precise in measuring
tenths of seconds. However, the application is to consider
a timer tick to represent a tenth of a second.) A card may
have a specification of a timer and a corresponding event
to occur after the timer expires. A timer begins to tick
when the card is entered and continues to count down
until it reaches zero. When the timer becomes 0, the spec-
ified event occurs.
For example, the following code will return the display
to the first card after five seconds:

<onevent type = "ontimer" >
<go href = "#Start"/>
</onevent>
<timer = value = "50" >

Enterforwardandenterbackwardkeep track of the
way a card was reached.Enterforwardoccurs when the
user reaches a card through any action except those that
pop the history stack.Enterbackwardcorresponds to
reaching a card by an action that pops the history stack. In
this respect, WML provides state awareness that is miss-
ing in HTML. A WML application can tell if a card is
reached by going back to it or if it is entered by a forward-
moving choice.
An event binding maps a task specification to an event
occurrence. For example,

<card id = "Third"
onenterbackward = "First">
<p> This is card Three </p>
</card>

will display “This is card Three if it is entered by choice
or by forward sequence, but will jump to the first card (or
the one labeled “First” to be exact) if it is reached by using
going back.”
Event pickappeared in the introductory example.
There,onpickwas used in the options nested within a
select element. For example,

<option onpick = "#weather"> Weather
</option>

mapped transfer to the card labeled “weather” when the
user highlights this option and pushes the accept button.
In summary, intrinsic events occur in three categories.
Enterforwardandenterbackwardmap to reaching the
card either by forward or backward navigation. Timer
events map to a timer going off.Pickmaps to an explicit
user selection.

Triggering Events with Access Keys
One user activity is listed with the intrinsic events: select-
ing a choice from a list and pressing a key or button as-
sociated with acceptance. There are a number of buttons
on the handheld devices used for wireless access. Events
can be associated with others besides theacceptkey and
there is another way to associate an event with pressing
the accept key. (On the simulator used in examples, the
acceptkey is below the screen and to the left. It is a
physical button, not the onscreen simulated button. The
onscreen button serves as a holder for a label for the real
button, which the user must push.) Thedoelement asso-
ciates an action with pressing a specified button on the
user device. For example,

<do type = "accept" label="Restart">
<go href="#Start"/>
</do>

produces the display shown in Figure 8. The label on the
accept button has been changed to say Restart. Pressing
Free download pdf