In the previous section, I explained the most basic concepts of WAP and WML, and in this section we'll look at how ASP and WAP are combined.
Section Fourth: Another way to book your movie tickets
Now in Oslo, cinemas offer a system based on the telephone to sell tickets, the system is very complex, and must give users some instructions to guide users to buy tickets,
And the user must also find some kind of movie code in the newspaper, this is annoying, let us introduce another method.
Here, this will show you a simple WAP application that allows mobile subscribers to book tickets: a service that is sure to be applauded. Users do not have to remember those annoying code, they can directly
Choose movies and cinemas from the menu, and users do not need authentication. In this example, the user is required to pay 40 minutes before the movie starts, but in real life,
Users can also checkout by phone.
This application imagines that a movie can be shown at multiple cinemas at the same time, and that a movie theater is staged at different times.
Here I do not think too much about the problem of error handling, because this is not the focus of this chapter, you like you can add yourself.
For simplicity, I used access 97来 as a database, and of course the real system won't use it, and other databases like SQL Server don't have to change much code.
Database diagrams
Database diagrams
. Movie and theater tables are clearly needed. The show table is used to track how many vacancies are still available for sale.
How to debug this program
In order to access this WAP service, you need a WAP emulator, which is mainly debugged on Nokia Toolkit 1.2, please check the previous section for details.
Choose a movie
Select a movie in the list list:
Here is the code:
<!--#include file= "conn.asp"--><%
' Send the right MIME type
Response.ContentType = "TEXT/VND.WAP.WML"
The first thing is to declare WML, and how the emulator does not declare XML in the correct place, it does not accept WML although Nokia 7110 can ignore this, there is no guarantee
Other phones are OK, so you have to do it. Also you have to set the MIME type well.
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >
<wml>
Before entering the next card there will be a flashing screen to display a picture wbmp a new format. This event is determined by the timer attribute, where we set the
The time is 5 seconds. OnTimer event is raised to take you to another card. (WMBP's Photoshop plugin can be downloaded free from the Internet).
<card id= "Splash" ontimer= "#card1" title= "Welcome to" >
<timer value= "/>"
<p align= "center" >
<br/>
</p>
</card>
<card id= "Card1" title= "Choose a film" >
<%
sqlquery = "SELECT [movie_id], [title] from Movie"
Set rsmovies = conn. Execute (SQLQuery)
:
%>
<p>
<select name= ' movie ' >
<%
Do as not rsmovies.eof
Response.Write ("<option value= '" & Rsmovies ("movie_id") & "' >" & Rsmovies ("title") & "</option > "& vbCrLf)
Rsmovies.movenext
Loop%>
</select>
This section is the focus of this article. read out the required data from the database to show that as an ASP programmer, this is nothing special, but this is the simple process
The order is now being used for a new server that looks different. This also makes me think more about the network programming ASP in the WML commercial station than the Java servlet.
<small>
<anchor title= "next!" >next
<go href= "step2.asp" method= "Get" >
<postfield name= "movie" Value= "$ (movie)"/>
</go>
</anchor>
</small>
</p>
The submission of forms can also be done through soft switching functions (do and anchor). Here, I do this through a simple inline link, because I think it's possible to use
Households feel intuitive and friendly. Postfields is about the same as the hidden in HTML, but the WML variable does not need to be routed in JavaScript as it does in HTML, it
Can be written directly in WML, as explained in the previous section. The method of passing here is that the Get,post method is also supported in the WAP specification, and the simulator can also recognize
It, but unfortunately, in Nokia 7110, this post is not supported, so you have no choice.