NOTE:
These slides have not been updated since 2003. They have been superseded by the book
Anders Møller and Michael Schwartzbach, February 2006 |
INTERACTIVE WEB SERVICES WITH JAVA |
The Poll Service |
HTML source:
<h3>The Poll Service</h3> <form action="http://freewig.brics.dk/users/laudrup/soccer.jsp" method="post"> Who wins the World Cup 2006? <select name="bet"> <option value="fr">France!</option> <option selected value="dk">Denmark!</option> <option value="other country">someone else?</option> </select><br> Please enter your email address: <input type="text" name="email"><br> <input type="submit" name="Submit" value="Go!"> </form> |
The browser collects the reply in a query string:
bet=other+country&email=john.doe%40notmail.com&Submit=Go%21 |
Values are URL-encoded: space becomes +, non-alphanumeric chars become %hexcode - assuming enctype="application/x-www-form-urlencoded" (the default)
GET vs. POST?
Uploading files requires POST and a different encoding of form data:
<form method="post" enctype="multipart/form-data" ...> <input type="file" ...> |
The response then contains:
COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH |