Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
390
Chapter 16 Using HTML Forms
16.2 The FORM Element
HTML forms allow you to create a set of data input elements associated with
a particular URL. Each of these elements is typically given a name and has a
value based on the original HTML or user input. When the form is submit 
ted, the names and values of all active elements are collected into a string
with 
= 
between each name and value and with 
&
 between each name/value
pair. This string is then transmitted to the URL designated by the 
FORM
 ele 
ment. The string is either appended to the URL after a question mark or sent
on a separate line after the HTTP request headers and a blank line, depend 
ing on whether 
GET
 or 
POST
 is used as the submission method. This section
covers the 
FORM
 element itself, used primarily to designate the URL and to
choose the submission method. The following sections cover the various user
interface controls that can be used within forms.
HTML Element:
...
Attributes:
ACTION
 (required), 
METHOD
, 
ENCTYPE
, 
TARGET
, 
ONSUBMIT
, 
ONRESET
, 
ACCEPT
, 
ACCEPT CHARSET
The 
FORM
 element creates an area for data input elements and designates the
URL to which any collected data will be transmitted. For example:
FORM input elements and regular HTML
The rest of this section explains the attributes that apply to the 
FORM
 ele 
ment: 
ACTION
, 
METHOD
, 
ENCTYPE
, 
TARGET
, 
ONSUBMIT
, 
ONRESET
, 
ACCEPT
, and
ACCEPT CHARSET
. Note that I am not discussing attributes like 
STYLE
, 
CLASS
,
and 
LANG
 that apply to general HTML elements, but only those that are spe 
cific to the 
FORM
 element. 
ACTION
The 
ACTION
 attribute specifies the URL of the servlet or CGI program 
that will process the 
FORM
 data (e.g., 
http://cgi.whitehouse.gov/ 
bin/schedule fund raiser
) or an email address where the 
FORM
data will be sent (e.g., 
mailto:audit@irs.gov
). Some ISPs do not 
allow ordinary users to create servlets or CGI programs, or they charge 
extra for this privilege. In such a case, sending the data by email is a 
convenient option when you create pages that need to collect data but 
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved