caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

JSP page
Config
URLs
Database Forms
XTP Copy
Hello Tag
Vary Filter
HardCore
Mailing Forms
Beans
Cache
XSL Filter
run-at
jndi app config

Forms
File Upload
Headers
 Forms

URLs
URLs
File Upload

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.

form.html

<form action="form.jsp" method="get">

<table>
<tr><td><b>Name</b>
    <td><input type="text" name="name">

<tr><td><b>Favorite color</b>
    <td><input type="text" name="color">
</table>

<input type="submit" value="Send">

</form>

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.

form.jsp
Name: <%= request.getParameter("name") %> <br>
Color: <%= request.getParameter("color") %> 

URLs
URLs
File Upload
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.