![if !IE]> <![endif]>
WMLScript complements to WML and provides a general scripting capability in the WAP architecture (WAP Forum, 2000h). While all WML content is static (after loading on the client), WMLScript offers several capabilities not supported by WML:
● Validity check of user input: before user input is sent to a server, WMLScript can check the validity and save bandwidth and latency in case of an error. Otherwise, the server has to perform all the checks, which always includes at least one round-trip if problems occur.
● Access to device facilities: WMLScript offers functions to access hardware components and software functions of the device. On a phone a user could, e.g., make a phone call, access the address book, or send a message via the message service of the mobile phone.
● Local user interaction: Without introducing round-trip delays, WMLScript can directly and locally interact with a user, show messages or prompt for input. Only, for example, the result of several interactions could be transmitted to a server.
● Extensions to the device software: With the help of WMLScript a device can be configured and new functionality can be added even after deployment. Users can download new software from vendors and, thus, upgrade their device easily.
The following six libraries have been defined so far:
● Lang: This library provides functions closely related to WMLScipt itself.Examples are isInt to check if a value could be converted into an integer or float to check if floating-point operations are supported.
● Float: Many typical arithmetic floating-point operations are in this library (which is optional as mentioned before). Example functions are round for rounding a number and sqrt for calculating the square root of a given value.
● String: Many string manipulation functions are in this library. Examples are well-known functions such as length to return the length of a string or subString to return a substring of a given string. Nevertheless, this library also provides more advanced functions such as find to find a substring within a string or squeeze to replace several consecutive whitespaces with only one.
● URL: This library provides many functions for handling URLs with the syntax defined in Fielding :
<scheme>://<host>:<port>/<path>;<parameters>?<query>#<fragment> for example: http://www.xyz.int:8080/mypages;5;2?j=2&p=1#crd.
The function getPath could now extract the path of this URL, i.e., "mypages", getQuery has the query part j=2&p=1" as return value, and getFragment delivers the fragment used in the URL, i.e., "crd".
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.