Forms
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Servlets and Filters
Portlets
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Introduction
JSP Compilation
Reference
Tutorials
Articles
FAQ

JSP Page Creation
Request
Topics
Tag Libraries

URL components
JSP environment
Form parameters
Multipart Forms
Headers
JSP environment
Request
Multipart Forms

Forms

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") %> 


JSP environment
Request
Multipart Forms
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.