Thursday, January 28, 2016

Just started to learn wap development, there is a small program to ask you




            


I made two pages index.wml and qycx.wml, codes are as follows
index.wml
& Lt;? Xml version = "1.0" encoding = "gb2312" & gt;?

& Lt;! DOCTYPE wml PUBLIC "- // WAPFORUM // DTD WML 1.1 // EN" "http://www.wapforum.org/DTD/ wml_1.1.xml" & gt;

& Lt; wml & gt;

& Lt; card id = "qycx" title = "Hello everyone" & gt;

& Lt; p & gt;
Please enter the data & lt; input name = "qycx" type = "text" maxlength = "16" / & gt;
& Lt; anchor title = "OK" & gt; determining
& Lt; go href = "qycx.wml" method = "post" & gt;
& Lt; postfield name = "qycx" value = "$ qycx" / & gt;
& Lt; / go & gt;
& Lt; / anchor & gt;

& Lt; br / & gt; & lt; br / & gt;
Hello everyone
& Lt; / p & gt;

& Lt; / card & gt;

& Lt; / wml & gt;


qycx.wml code below
& Lt;? Xml version = "1.0" & gt;?
& Lt; -! Created by WAPtor (http://www.waptop.net/) - & gt;
& Lt;! DOCTYPE wml PUBLIC "- // WAPFORUM // DTD WML 1.1 // EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

& Lt; wml & gt;

& Lt; -! THIS IS THE FIRST CARD IN THE DECK - & gt;
& Lt; card id = "MainCard" title = "This is a first card" & gt;
& Lt;%
id = request.form ("qycx")
response.write id
response.end
set conn = server.createobject ("adodb.connection")
conn.open "driver = {microsoft access driver (* .mdb)}; dbq =" & amp; server.mappath ("qycx.mdb")

sql = "select * from info where name like '%" & amp; id & amp; "%'"
set rs = server.createobject ("adodb.recordset")
rs.open sql, conn, 1,1
do while not rs.eof
bh = response.write ("id")
mc = rs ("name")
% & Gt;
& Lt; a href = "detail.wml id = & lt;?% Response.write bh% & gt;" & gt; & lt;% response.write mc% & gt; & lt; / a & gt;
& Lt;%
rs.movenext
loop
rs.close
% & Gt;
& Lt; p align = "center" & gt;
This is a sample text
& Lt; / p & gt;
& Lt; / card & gt;

& Lt; / wml & gt;

Database structure table info, field id, name

The question now is index.wml displayed correctly, enter the query conditions, press OK, the error HTTP Error: 405, how is this going on?
Reply:
& Lt;% Response.ContentType = "text / vnd.wap.wml; charset = utf-8"% & gt;
& Lt;? Xml version = "1.0" encoding = "utf-8" & gt;?
& Lt;! DOCTYPE wml PUBLIC "- // WAPFORUM // DTD WML 1.1 // EN" "http://www.wapforum.org/DTD/wml_1.1.xml">


ASP + WML You little head:
& Lt;% Response.ContentType = "text / vnd.wap.wml; charset = utf-8"% & gt;
Added change to change it
Reply:
head qycx.wml page
Reply:
How plus
head in qycx.wml& Lt;% Response.ContentType = "text / vnd.wap.wml; charset = utf-8"% & gt;
It
error is still thereFrom the time you press OK submitted index.wml still there
HTTP Error: 405
This error
Reply:
You use the asp qycx.wml can not be
wml suffixAsp suffix should be changed, and then remember to add asp output wml header information, you can file another is gb2312, then make sure your asp is gb2312
Reply:
For a
1.index.wml in href = "qycx.asp"
2.qycx.wml into qycx.asp
3.qycx.asp head should be
& Lt;% Response.ContentType = "text / vnd.wap.wml; charset = gb2312"% & gt;
& Lt;? Xml version = "1.0" encoding = "gb2312" & gt;?
& Lt;! DOCTYPE wml PUBLIC "- // WAPFORUM // DTD WML 1.1 // EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

Reply:
It seems not `
I use the ASP but static display is right
Dynamic data read out from the database will not be able to
I write it straightforward to write code to pull
I use
Opera browser testingThe result is so
& Lt;% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "65001"% & gt; & lt;% Function outHTM (str) 'The string HTM decoded output string Dim sTemp sTemp = str outHTM = "" If IsNull (sTemp) Then Exit Function End If sTemp = Replace (sTemp, "'", "'") 'Restore single quotes sTemp = Replace (sTemp, "& amp;", "& amp;") sTemp = Replace (sTemp, "& lt;", "& lt;") sTemp = Replace (sTemp, "& gt;", "& gt;") sTemp = Replace (sTemp, "$", "$$") sTemp = Replace (sTemp, "", "") sTemp = Replace (sTemp, Chr (10), "
") OutHTM = sTemp End Function Sql =" SELECT * FROM ly ORDER BY lyid DESC "Set Rs = Server.CreateObject (" Adodb.Recordset ") Rs.Open Sql, conn, 1,3 page = Request.QueryString (" Page ") Rs.PageSize = 6 'a six record IF Not IsEmpty (Page) Then IF Not IsNumeric (Page) Then' determine whether the Page to digital Page = 1 Else Page = Cint (Page) 'is converted into a short plastic Integer End IF IF Page & gt; Rs.PageCount Then Rs.AbsolutePage = Rs.PageCount 'is set equal to the last page of the currently displayed page ElseIF Page & lt; = 0 Then Rs.AbsolutePage = 1' is set equal to the first page of this page Else Rs.AbsolutePage = Page 'if greater than zero, show this page to receive equal number of pages End IF Else Rs.AbsolutePage = 1 End IF Page = Rs.AbsolutePage% & gt; & lt;% Response.ContentType = "text / vnd.wap.wml; charset = gb2312 "% & gt;

Post new stickers
& Lt;% For i = 1 to Rs.PageSize If Rs.Eof Then Response.Write "No message of
!"Exit For End If% & gt; (& lt;% = Rs (" lyid ")% & gt;) & lt;% = outHTM (Rs (" lytitle "))% & gt;
Content: & lt;% = outHTM (Rs ("lycontent"))% & gt;
Message by: & lt;% = outHTM (Rs ("lyusername"))% & gt;
Time: & lt;% = outHTM (Rs ("lytime"))% & gt;
Re: & lt;% if Rs ("replay") & lt; & gt; "" then Response.Write outHTM (Rs ("replay")) else Response.Write "" No Reply "" end if% & gt;
------
& Lt;% Rs.MoveNext Next if page & gt; = Rs.PageCount then 'Response.Write ("[Next]") else Response.Write ("[Next]") end if if page & lt; = 1 then' Response.Write ("[Previous]") else Response.Write ("[Previous]") end if% & gt;
Post new stickers

I ask how the test ASP suffix WAP network

No comments:

Post a Comment