<title browser-title='Forms : Resin Tutorial'>
Forms
</title>

Forms are, of course, the most important way of getting information
from the customer of a web site.  In this section, we'll just create a
simple color survey and print the results back to the user.

<p>First, create the entry form.  Our HTML form will send its answers
to form.jsp for processing.

<p>For this example, the <code/name="name"/> and <code/name="color"/>
are very important.  You will use these keys to extract the user's
responses.

<ct:example title='form.html'>

&lt;form action="form.jsp" method="get"&gt;

&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Name&lt;/b&gt;
    &lt;td&gt;&lt;input type="text" name="name"&gt;

&lt;tr&gt;&lt;td&gt;&lt;b&gt;Favorite color&lt;/b&gt;
    &lt;td&gt;&lt;input type="text" name="color"&gt;
&lt;/table&gt;

&lt;input type="submit" value="Send"&gt;

&lt;/form&gt;

</ct:example>

<p>Resin keeps the browser request information in the
<code/request/> object.  The <code/request/> object contains the
environment variables you may be familiar with from CGI programming.
For example, it has the browser type, any HTTP headers, the server
name and the browser IP address.

<p>You can get form values using <code/request.getParameter/> object.

<p>The following JSP script will extract the form values and print them
right back to the user.

<ct:example title='form.jsp'>
&lt;%@ page language=java %>

Name: &lt;%= request.getParameter("name") %&gt; &lt;br&gt;
Color: &lt;%= request.getParameter("color") %&gt; 
</ct:example>


