Writing dynamic phone pages using WML and ASP

Source: Internet
Author: User
The combination of ASP and WAP can generate rich and dynamic WML Web pages, which brings many interesting contents to WAP phone. So how do they combine the two organically to generate dynamic Web pages? In this article, I would like to explain how to use ASP to develop a dynamically generated WML application. For example, now that the e-banking of mobile phones is being fired, how do we build such an application? Here I do not want to discuss the establishment of the entire electronic bank, because that content is too large, beyond the scope of my introduction, here I just want to introduce how to use ASP to build an application to check the user's balance of payments. In view of its security, we want to use WTLS, but this problem is more complex, can only wait until later on the opportunity to explore. We need to focus on how to use ASP to implement dynamic Web pages.

Say so much nonsense, let's get started. Assuming that the bank account information is stored in the SQL database, you can access our system if you use the appropriate network connection. In the example in this article, in order to simplify our account information is very small (in fact, it is not): Only account number, customer name, security password and account balance, in a table (Tbl_account_info), there are four fields corresponding to the Accountno,custname , Accountpin and Accountbal.

Below, I want to briefly talk about the programming idea: first, the user enters our system interface, enters their account number and the security password (Figure 1), after verifying these login information, we allow the user to log into the system, we will give the welcome language, and the user name and the account balance of payments situation output.

This is the general idea of development, well, now we can be programmed according to this idea. I have a habit, when I write dynamic program code, I first write the static code, and then try to write the dynamic code. I will also use this approach in this article.

First, in the first part of the code, we're going to create a page to use to receive the user's login information. (Figure 1)

Note the following code, which is the most basic WML code:

<% Response.ContentType = "TEXT/VND.WAP.WML"%>
//Note this sentence, if you want to display Chinese, you must add encoding= "gb2312"
! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en"
"Http://www.wapforum.org/DTD/wml_1.1.xml" >


Welcome to WAP e-bank

Please input account:
Security Password:









After establishing the user login Information page, we will verify that the user filled information is illegal, such as the account is not full of the corresponding number of digits, security password is not filled, etc., these steps are generally done at the client, so that the use of wireless communication connection to minimize the processing process, To mitigate communication disruptions caused by traffic congestion. Because the phone is different from the ordinary PC, its bandwidth is relatively small, the connection is slow.

Well, next we're going to really join the database, we're going to issue a standard SQL request statement, and then the server will return a recordset, and we'll extract the information we need in the recordset and then display it in the corresponding field on the next page. These are dynamic content: Get the request information from the user, and then show them the dynamic information they want to get, so that "personalized Mobile information". Please look at the code:


<%
TxtSQL = "SELECT * from Tbl_account_info WHERE accountno= '"
Request.Form ("Accountno") & "' and Accountpin= '"
Request.Form ("Accountpin") & "'"
Set rs = conn. Execute (TxtSQL)
If Rs. EOF Then
Response.Write "Invalid Login"
Response.Write " "
Response.Write " "
Response.Write " "
Else
Response.Write "Hello," & Rs. Fields ("CustName") & "Mr."
"
Response.Write "Your balance is ¥" & Rs. Fields ("Accountbal")
%>

After we get the information back from the server, we display the information


Well, a simple e-banking query system is written. From the above example, we can see that in the design of WAP pages to pay attention to the following issues:

1, to maintain the content, short and capable. The information we provide based on user requests must be concise and fast enough to meet their requests.

2, the use of ASP can very quickly write dynamic WML page, and it is written with ASP Common page basic phase test, only a few minor changes, such as the inclusion of WML page recognition tags. You can also try to write some other dynamic content.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.