Teach you how to build a WAP application development environment

Source: Internet
Author: User
Tags tomcat
WAP (Wireless application protocal) is an open protocol, which differs from the Japanese i-mode, which is closed. WAP is actually a combination of wireless networks and Internet networks. The original wireless network is mainly carrying voice services, while the Internet data business has been very mature.

The demand of data service in wireless network facilitates the formation of WAP. You can even think of WAP as a lightweight HTTP protocol that is tailored for wireless networks.

As a developer, we should understand how WAP works and how it can be programmed, and it will be easier to understand if you have experience with Web application development. In fact, it is a b/S model, where the browser is not a traditional browser but to support the user Agent WAP device, can also be understood as a WAP browser.

And the server is a general Web server, you can use IIS, Apache or other Web servers, because the HTML is not suitable for resource-intensive wireless device transmission so we use the WML language on the server. In fact, when users access the network through the wireless device, the first request to go through the WAP Gateway, WAP gateway to the data appropriate codec, and then send the data request to the Web server, processing data after the WAP gateway codec sent to the phone.

And this is transparent to programmers, you just need to manage the server's code. The following picture will help you understand this programming model, if you want to know more about WAP, recommend you read a "mobile internet and WAP technology", although not very deep but relatively clear.



Since our server can use a general Web server, then here I use TOMCAT5.0 as a Web server, first you need to download tomcat5.0 and install from http://www.apache.org. Suppose the installation path is C:\tomcat 5.0. Set well in environment variables:

   
    
     
    CATALINA_HOME=C:\TOMCAT 5.0
   
    

Set up a good java_home=c:\j2sdk1.4.2_03. Enter the Catalina_home/bin directory, run startup Tomcat, and the default port is 8080. Open the browser to enter http://localhost:8080 in the address.

The sight of the Tom Cat indicates that the installation was successful. The tomcat5.0 version has generally been supported for WML, and if not, modify the Catalina_home/conf/web.xml. Add the following in the MIME mapping section:

   
    
     
    <mime-mapping>        <!--WML Source-->        <extension>wml</extension>        <mime-type >  text/vnd.wap.wml  </mime-type>    </mime-mapping>    <mime-mapping>        < !--Compiled WML-->        <extension>wmlc</extension>        <mime-type>  application/ VND.WAP.WMLC  </mime-type>    </mime-mapping>    <mime-mapping>        <!--WML Script Source-->        <extension>wmls</extension>        <mime-type>  text/ Vnd.wap.wmlscript  </mime-type>    </mime-mapping>    <mime-mapping>        <!-- Compiled WML Script-->        <extension>  wmlscriptc  </extension>        <mime-type>  APPLICATION/VND.WAP.WMLSCRIPTC  </mime-type>    </mime-mapping>
   
    

You can also add INDEX.WML as the default access page in Welcome-list:

   
    
     
    <welcome-file-list>     <welcome-file>index.wml</welcome-file>        <welcome-file> index.html</welcome-file>        <welcome-file>index.htm</welcome-file>        <welcome-file >index.jsp</welcome-file>    </welcome-file-list>
   
    


This way the server can already be used to develop WAP applications.

When debugging the program we need to debug on the Wap browser, I chose the Winwap browser as the development debugging tool, it is very convenient to use. First download the latest Winwap 3.1pro version from http://www.winwap.org, the 30-day probationary period.

Install the same as other application installations, let's write a simple WML file test, and the advanced usage of WML and WML script will be introduced in the following articles:

   
    
     
    Index.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 id= "Myfirstcard" title= "I" >    <p align= "center" >      Hello tech.ccidnet.com       </p>  </card></wml>
   
    


Put this file under Catalina_home/webapps/root/, start Winwap and enter HTTP://YOURIP:YOURPORT/INDEX.WML in the address, and you'll see Hello in Winwap. Tech.ccidnet.com.


If you have a mobile phone with a WAP browser and Internet access, you can also test it, and I use the NOKIA6108 test successfully. I hope this building environment is helpful to everyone.

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.