HDML with ASP - starting the WML adventure
Dan Pitu
This article is for the beginners and its goals is to provide some advice for you to avoid some general problems which can occur during the first phase of WAP development.
I will consider you have already installed a simulator. Let's say you have SDK 4.1 from OpenWave: http://developer.openwave.com/download/
Once you can access this UP. Simulator you have already made the first step. What's next? Don't forget: Start-Programs-UP.SDK 4.1-UP.Simulator Do you have it? Ok!
Having 2 tables in an Access database: Persons and Profession, you will see a kind of master detail structure implementing for WAP. So let's put some ASP code to work for us. Classic ADO connection, some links and parameter transmission between 2 pages will be all what we need. Assuming the MIME types are properly configured on your computer (it isn't the goal of this article) let's have a look at the code of persons.asp :
<!-- persons.asp -->
<!-- WARNING
if you copy/paste this code, my advice is to inspect it, especially on double quota (") char
-->
<% Response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<!-- MAIN CARD-->
<card id="PersonsCard">
<p align="left"><small><b>ASP WAP EXAMPLE </b></small></p>
<%
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("persons.mdb")
set conn = server.createobject("ADODB.Connection")
conn.open strconn
set rs = server.createobject("adodb.recordset")
Query = "Select * from persons"
rs.open Query, conn
if not rs.eof Then
rs.movefirst
Do While NOt Rs.EOF
idProf = rs("idProf")
%>
<p align="left">
<small>
<anchor><%=rs("LastName")%>
<go href="profession.asp?idProf=<%=idProf%>"/>
</anchor>
</small>
</p>
<%
rs.movenext
Loop
else
response.write("<p align='left'><small>No one here.</small></p>")
End if
rs.close
Set conv = nothing
set rs= nothing
set conn = nothing
%>
</card>
</wml>
<!-- End persons.asp>
How does it look like? Something like this:

Afterwards you can see profession.asp which is, of course a kind of detail page for the previous one.
