Welcome to Developer's Home Friday, April 18, 2014
Home - DevelopersHome.com

At the Server-side


Preferences - Do not show ads

At the server side, the parameter name will be used to retrieve the form data. You can use your favorite server-side technology to do the processing required by your mobile Internet application. Some examples of server-side technology are ASP, Java Servlet, JSP, Perl and PHP.


ASP Version

Below is the processing.asp file that contains the ASP code for processing the form data submitted from our earlier WML document. What the ASP code does is very simple. It just prints out the form data received. In real WAP applications, the server probably needs to do more complicated processing. For example, storing the form data to a database such as MySQL, PostgreSQL, Microsoft SQL Server, Oracle Database, etc.

Remember to set the MIME type of the document to "text/vnd.wap.wml".


(processing.asp)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<% Response.ContentType = "text/vnd.wap.wml" %>

<wml>
  <card id="card1" title="WML Form">
    <p>
      Data received at the server:<br/>
      Name: <% =Request.QueryString("name") %><br/>
      Gender: <% =Request.QueryString("gender") %><br/>
      Which part of our WML tutorial do you like?
      <% =Request.QueryString("tutorial_part") %><br/>
      temp_id: <% =Request.QueryString("temp_id") %>
    </p>
  </card>
</wml>


Let's say you enter "Andrew" in the input field, select the "I am a boy" option in the first selection list, select the "Part 1" and "Part 2" options in the second selection list and click the "Submit Data" link. The screenshots below show what you should see in some mobile phone browsers:






Sony Ericsson T610





Sony Ericsson T68i





Nokia Mobile Browser 4.0


JSP Version

Below is the JSP version that produces the same result as the above ASP code:


(processing.jsp)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<% response.setContentType("text/vnd.wap.wml"); %>

<wml>
  <card id="card1" title="WML Form">
    <p>
      Data received at the server:<br/>
      Name: <%= request.getParameter("name") %><br/>
      Gender: <%= request.getParameter("gender") %><br/>
      Which part of our WML tutorial do you like?
      <%= request.getParameter("tutorial_part") %><br/>
      temp_id: <%= request.getParameter("temp_id") %>
    </p>
  </card>
</wml>


PHP Version

And here is the PHP version:


(processing.php)

<?php header('Content-type: text/vnd.wap.wml'); ?>
<?php echo '<?xml version="1.0"?'.'>'; ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<wml>
  <card id="card1" title="WML Form">
    <p>
      Data received at the server:<br/>
      Name: <?php echo $_GET["name"]; ?><br/>
      Gender: <?php echo $_GET["gender"]; ?><br/>
      Which part of our WML tutorial do you like?
      <?php echo $_GET["tutorial_part"]; ?><br/>
      temp_id: <?php echo $_GET["temp_id"]; ?>
    </p>
  </card>
</wml>


Page 47 of 50 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






WML Tutorial Table of Contents WML Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page