1.
Simple WAP Page
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="main" title="Welcome">
<p>Hello, this is a basic WAP page!</p>
</card>
</wml>
Expected Output: Displays a simple WAP page with a welcome message.
2. User Input
<wml>
<card id="input">
<p>Enter your name:</p>
<input name="user_name"/>
<do type="accept" label="Submit"> <go
href="welcome.wml?name=$(user_name)"/>
</do>
</card>
</wml>
Expected Output: Prompts user to enter a name and submit it.
3. Simple Navigation
<wml>
<card id="menu" title="Menu"> <p><a
href="page2.wml">Go to Page 2</a></p>
</card>
</wml>
Expected Output: Provides a link to navigate to another WAP page.
4. Display Variables
<wml>
<card id="welcome">
<p>Welcome, $(name)!</p>
</card>
</wml>
Expected Output: Displays a personalized message using a variable.
5. Using WMLScript
<wml>
<card id="script">
<p>Click to run script:</p>
<do type="accept" label="Run"> <go
href="script.wmls#showMessage()"/>
</do>
</card>
</wml>
Expected Output: Runs a WMLScript function when clicked.
6. WMLScript Example
extern function showMessage() {
alert("Hello from WMLScript!"); }
Expected Output: Displays an alert message.
7. Simple Form
<wml>
<card id="form">
<p>Enter Age:</p>
<input name="age" type="number"/>
<do type="accept" label="Submit">
<go href="checkAge.wml?age=$(age)"/>
</do>
</card>
</wml>
Expected Output: Takes user input for age and submits it.
8. Conditional Display
<wml>
<card id="ageCheck">
<p>$(20) is a valid age.</p>
</card>
</wml>
Expected Output: Displays the entered age as valid.
9. Multiple Cards
<wml>
<card id="one"><p>Card 1: <a href="#two">Next</a></p></card>
<card id="two"><p>Card 2: <a href="#one">Back</a></p></card>
</wml>
Expected Output: Allows navigation between two cards.
10. Image Display
<wml>
<card id="image"> <p><img
src="logo.wbmp" alt="Logo"/></p>
</card>
</wml>
Expected Output: Displays an image using WBMP format.
11. Redirect Page
<wml>
<card id="redirect">
<timer value="5"/>
<p>Redirecting...</p>
<do type="accept">
<go href="home.wml"/>
</do>
</card>
</wml>
Expected Output: Automatically redirects to another page after 5 seconds.
12. Call a Number
<wml>
<card id="call"> <p><a
href="wtai://wp/mc;1234567890">Call Now</a></p>
</card>
</wml>
Expected Output: Provides a clickable link to dial a phone number.
13. Simple List
<wml>
<card id="list">
<p>Select an option:</p>
<select name="choice">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
<do type="accept" label="Go"> <go
href="result.wml?choice=$(choice)"/>
</do>
</card>
</wml>
Expected Output: Displays a dropdown list for selection.
14. Basic Authentication
<wml>
<card id="auth">
<p>Enter Username:</p>
<input name="user"/>
<do type="accept" label="Login">
<go href="login.wml?user=$(user)"/>
</do>
</card>
</wml>
Expected Output: Takes username input for login.
15. Back Navigation
<wml>
<card id="back"> <p><a
href="javascript:history.back();">Go Back</a></p>
</card>
</wml>
Expected Output: Provides a link to go back to the previous page.
16. Redirecting to Another Card
<wml> <card id="redirect"
title="Redirecting">
<timer value="5"/> <p>Redirecting to the home
card in 5 seconds...</p>
<do type="accept" label="Go Now">
<go href="#home"/>
</do>
</card>
<card id="home" title="Home">
<p>Welcome to the home card!</p>
</card>
</wml>
Expected Output: Redirects from 'Redirecting' card to 'Home' card after 5 seconds.
17. Using Tables in WML
<wml> <card id="table" title="Table
Example">
<p>
<table columns="2">
<tr>
<td>Name</td>
<td>Age</td>
</tr>
<tr>
<td>John</td>
<td>25</td>
</tr>
<tr>
<td>Jane</td>
<td>30</td>
</tr>
</table>
</p>
</card>
</wml>
Expected Output: Displays a table with Name and Age columns.
18. Using Templates for Consistency
<wml>
<template> <do type="prev"
label="Back">
<prev/>
</do>
</template>
<card id="card1" title="Card 1">
<p>This is the first card.</p> <p><a
href="#card2">Go to Card 2</a></p>
</card>
<card id="card2" title="Card 2">
<p>This is the second card.</p> <p><a
href="#card1">Back to Card 1</a></p>
</card>
</wml>
Expected Output: Adds a 'Back' button on both cards for navigation.