| ||||||||||||||
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. First, create the entry form. Our HTML form will send its answers to form.jsp for processing. For this example, the name="name" and name="color" are very important. You will use these keys to extract the user's responses.
Resin keeps the browser request information in the request object. The 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. You can get form values using request.getParameter object. The following JSP script will extract the form values and print them right back to the user.
|