Actual Combat ASP (6): Using WML and ASP to write dynamic mobile phone page

Source: Internet
Author: User
Tags join sql
Dynamic | pages using WML and ASP to write dynamic mobile phone pages

The combination of ASP and WAP can generate rich dynamic WML Web pages, which can bring a lot of interesting content to WAP phone. So how do they combine 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, the electronic banks of mobile phones are now fired up, so how do we build an application like this? I don't want to talk about the establishment of the entire electronic bank, because it's too big for me to cover, and here I just want to explain how to use ASP to build an application to check the balance of payments for users. Considering its security, we have to use WTLS, but this problem is more complex, can only wait for the opportunity to explore. We need to focus on how to use ASP to implement dynamic Web pages.

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

Next, I want to talk about programming ideas briefly: first, the user enters our system interface, enters their account number and the security password (like Figure 1), after verifying these login information, we allow the user to log in to enter the system, we will give the welcome language, and the user name and the account balance condition output!

This is the general idea of development, OK, now we can according to this idea to program. 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 that will be used to receive user login information.
Note the following code, which is the most basic WML code:

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


Welcome to WAP Electronic Bank

Please enter the account number:
Security Password:



Set up to receive the user login Information page, we have to verify that the user filled information is illegal, such as the account does not fill the corresponding digits, the security password is not filled, and so on, these steps are generally in the client, so that the use of wireless communication connection process to achieve the minimum level, To mitigate communication disruptions caused by traffic congestion. Because the handset is different from the ordinary PC after all, its bandwidth is relatively small, the connection is slow.

OK, 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, where we can extract the information we need and then display it in the corresponding field on the next page. These are dynamic content: Get the request information from the user, 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'll show you the information.

Well, a simple electronic bank query system is written. From the example above, we can see the following questions to be noted when designing a WAP page:

1, to maintain content, short lean. The information we provide based on user requests must be concise and able to meet their requests quickly!

2, the use of ASP can be very quick to complete the writing of 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 of the 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.