WML Learning (VII): CGI programming

Source: Internet
Author: User
Tags add key string version
cgi| programming CGI Programming
   1 To add a WML MIME type on the Web server

For IIS4, you can add a new MIME type, suffix. WML, and MIME type TEXT/VND.WAP.WML in the site properties in its manager.
For PWS, you can modify the registry to add a primary key to the HKEY_CLASSES_ROOT layer first. WML, then add the string value content type to TEXT/VND.WAP.WML, and then in hkey_local_machine\software\ Add the primary key TEXT/VND.WAP.WML to the Classes\mime\database\content type\ and add the string value extension to. wml.
Previously mentioned HDML are also used in a similar way.

   2 accessing WML files in HTTP mode

You can access WML files by typing http://localhost/test.wml in the URL bar of your mobile browser.

   3) CGI Design

The same way as a normal CGI, but when you return a result, you first output content-type as TEXT/VND.WAP.WML and then output the WML content.

Test10.wml
---------------
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >

<wml>
<meta http-equiv= "Cache-control" content= "max-age=0"/>
<card id= "Card0" >
<do type= "Accept" label= "Input Name" name= "Do1" >
<go href= "http://localhost/test.asp" method= "POST" >
<postfield name= "UID" value= "123456"/>
<postfield name= "uname" value= "$ (username:esc)"/>
</go>
</do>
<p>
Name:<input name= "UserName" title= "User name" type= "text" format= "*m" emptyok= "false" maxlength= ""/>
</p>
</card>

Test10.asp
---------------
<%
Uid=request.form ("UID")
Username=request.form ("uname")
Response.contenttype= "TEXT/VND.WAP.WML"
%>
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >

<wml>
<card>
<p>
Username:<%=username%>
User__id:<%=uid%>
</p>
</card>
</wml>

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.