Reading All Parameters
Home ] Up ] Reading Form Parameters ] [ Reading All Parameters ] Form Beans ]

 

 

You can also read all the form's parameters.

Here's a more complex form:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>Personal Information</title>
  </head>
  <body>
    <h1 align="center">Personal Information</h1>
    <form action="Form2Servlet" method="post">
      <table border="0">
        <tr>
          <td>
            First Name: <input type="text" name="first-name"/><br />
            Last Name: <input type="text" name="last-name"/><br />
            Occupation: <input type="text" name="occupation"/><br />
          </td>
          <td>
            <h3>Age:</h3> 
            <input type="radio" name="age" value="U18">Under 18</input><br />
            <input type="radio" name="age" value="18to21">18 to 21</input><br />
            <input type="radio" name="age" value="22to55">22 to 55</input><br />
            <input type="radio" name="age" value="56to60">56 to 60</input><br />
            <input type="radio" name="age" value="over60">Over 60</input><br />
          </td>
        </tr>
        <tr>
          <td>
            <h3>Address</h3>
            Street: <input type="text" name="street"/><br />
            City: <input type="text" name="city"/><br />
            State: <input type="text" name="state"/><br />
            ZIP: <input type="text" name="zip"/><br />
            Country: <input type="text" name="country"/><br />
          </td>
          <td>
            <h3>Miscellaneous</h3>
            Describe yourself:<br/>
            <textarea name="description" rows="5" cols="40"></textarea><br />
          </td>
        </tr>
      </table>
      <hr/>
      Enter Password: <input type="password" name="password"/><br/>
      Re-enter Password: <input type="password" name="password"/><br/>
      <input type="submit"/>
    </form>
  </body>
</html>

which displays like this:

Here's what the servlet returns from this form:

Notice the "No value" entries, and the two values for password.

 
The page was last updated February 19, 2008