WMLScript

WMLScript

Wen-Chen Hu (University of North Dakota, USA)
DOI: 10.4018/978-1-59140-769-0.ch008
OnDemand PDF Download:
$37.50

Abstract

WML is a markup language used for text formatting and displaying (Open Mobile Alliance, 2001). However, the functions of a markup language are limited if there is no support from other programming languages. Two kinds of programming languages can help to extend the functions of WML: 1. server-side scripts such as CGI Perl running on servers, and 2. client-side scripts such as WMLScript running on handheld devices. This chapter focuses on WMLScript, building on the descriptions of WML and CGI provided in the previous two chapters. WMLScript (Open Mobile Alliance, 2000a) is a light JavaScript language (Netscape Communications Corporation, n. d.) that must be compiled into byte code on a server before it can run on a handheld device. It is based on ECMAScript but has been modified to better support low bandwidth communication and thin clients. WMLScript can be used in conjunction with WML to provide intelligent content to clients, but can also be used as a stand alone tool.
Chapter Preview
Top

Introduction

WML is a markup language used for text formatting and displaying (Open Mobile Alliance, 2001). However, the functions of a markup language are limited if there is no support from other programming languages. Two kinds of programming languages can help to extend the functions of WML:

  • 1.

    server-side scripts such as CGI Perl running on servers, and

  • 2.

    client-side scripts such as WMLScript running on handheld devices.

This chapter focuses on WMLScript, building on the descriptions of WML and CGI provided in the previous two chapters. WMLScript (Open Mobile Alliance, 2000a) is a light JavaScript language (Netscape Communications Corporation, n. d.) that must be compiled into byte code on a server before it can run on a handheld device. It is based on ECMAScript but has been modified to better support low bandwidth communication and thin clients. WMLScript can be used in conjunction with WML to provide intelligent content to clients, but can also be used as a stand alone tool.

Top

Wmlscript Activation

Unlike JavaScripts, which are embedded in HTML pages, WMLScripts are not embedded in WML pages. To activate a WMLScript from a WML page, the page contains references to the URL of the WMLScript. Figure 1 shows how to call a WMLScript from a WML page. The example shown is a single-item selection for displaying the selected sports page. Assume the WML script in Figure 1 is located at http://people.cs.und.edu/~userid/handheld/wmls/Functions.wmls. The activation uses the href attribute of the go element to find the destination WMLScript and sends an argument $(item) storing the item selected.

Figure 1.

The WML script Activate.wml showing how to activate a WMLScript

Figure 2.

The function goto activated by the WML page in Figure 1

The WMLScript function goto in Figure 2 is in a file called Functions.wmls and the function uses the extern keyword. When using this keyword, the function can be called by other functions or WML events outside the .wmls file. To keep a function private, the extern keyword must be dropped. The optional extern keyword can be used to specify a function to be externally accessible. Such functions can be called from outside the compilation unit in which they are defined. There must be at least one externally accessible function in a compilation unit. This function checks whether the item, for example NBA or NFL, is selected. If it is, the corresponding homepage is displayed; if not, the message “Not found” is shown. It uses three features of WMLScript, which will be explained in more detail later:

  • 1.

    If statement,

  • 2.

    The go function of the WMLBrowser library, which goes to a new card, specified by the new URL, and returns an empty string, and

  • 3.

    The alert function of the Dialog library, which displays a message, waits for a confirmation, and then returns an empty string.

Complete Chapter List

Search this Book:
Reset
Table of Contents
Preface
Wen-Chen Hu
Chapter 1
Wen-Chen Hu
With the introduction of the World Wide Web, electronic commerce revolutionized traditional commerce, boosting sales and facilitating exchanges of... Sample PDF
Fundamentals of Mobile Commerce Systems
$37.50
Chapter 2
Wen-Chen Hu
Commerce, the exchange or buying and selling of commodities on a large scale involving transportation of goods from place to place, benefits from... Sample PDF
Mobile Commerce Applications
$37.50
Chapter 3
Wen-Chen Hu
Mobile users interact with mobile commerce applications by using small wireless Internet-enabled devices, which come with several aliases such as... Sample PDF
Mobile Handheld Devices
$37.50
Chapter 4
Wen-Chen Hu
Without ways to conduct secure commercial information exchange and safe electronic financial transactions over mobile networks, neither service... Sample PDF
Essential Mobile-Commerce Technology
$37.50
Chapter 5
Wen-Chen Hu
As handheld computing is a fairly new computing area, there is as yet no generally accepted formal definition. For the purposes of this book... Sample PDF
Mobile World Wide Web Content
$37.50
Chapter 6
Wen-Chen Hu
Wireless application protocol (WAP) (Open Mobile Alliance, 2003) is a suite of network protocols that specifies ways of sending data across the... Sample PDF
WML (Wireless Markup Language)
$37.50
Chapter 7
Advanced WML  (pages 180-206)
Wen-Chen Hu
Chapter VI discusses the creation of static web pages, which have a fixed content at all times. In order to change static web pages to dynamic ones... Sample PDF
Advanced WML
$37.50
Chapter 8
WMLScript  (pages 207-228)
Wen-Chen Hu
WML is a markup language used for text formatting and displaying (Open Mobile Alliance, 2001). However, the functions of a markup language are... Sample PDF
WMLScript
$37.50
Chapter 9
Wen-Chen Hu
Numerous server-side handheld applications are available for devices. Some popular applications include: • Instant messages, which require service... Sample PDF
Database-Driven Mobile Web Content Construction
$37.50
Chapter 10
Wen-Chen Hu
There are two kinds of handheld computing and programming, namely client- and server- side handheld computing and programming. The most popular... Sample PDF
Client-Side Handheld Computing and Programming
$37.50
Chapter 11
Wen-Chen Hu
Most client-side handheld programming uses either Java or C/C++. This chapter introduces Java ME (previously known as J2ME), which is a version of... Sample PDF
Java ME (Java Platform, Micro Edition) Programming
$37.50
Chapter 12
Wen-Chen Hu
Chapter XI introduced the basics of Java ME programming. This chapter will build on this, focusing on advanced Java ME programming. The following... Sample PDF
Advanced Java ME Programming
$37.50
Chapter 13
Palm OS Programming  (pages 333-350)
Wen-Chen Hu
Programming for Palm devices is not a trivial task and it is especially hard for beginners starting their first assignment. This chapter is not... Sample PDF
Palm OS Programming
$37.50
Chapter 14
Wen-Chen Hu
The introduction to Palm OS programming given in the previous chapter provided an overview of its structure and basic concepts. This chapter... Sample PDF
Advanced Palm OS Programming
$37.50
The Resource Description Files: ResourceDescription1.xrd
About the Author