Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
16.4 Push Buttons
401
Core Warning
Netscape does not support the
BUTTON
element.
Submit Buttons
HTML Element:
(No End Tag)
Attributes:
NAME
,
VALUE
,
ONCLICK
,
ONDBLCLICK
,
ONFOCUS
,
ONBLUR
When a submit button is clicked, the form is sent to the servlet or other
server side program designated by the
ACTION
parameter of the
FORM
.
Although the action can be triggered other ways, such as the user clicking on
an image map, most forms have at least one submit button. Submit buttons,
like other form controls, adopt the look and feel of the client operating sys
tem, so will look slightly different on different platforms. Figure 16 11 shows
a submit button on Windows 98, created by
Figure 16 11 A submit button with the default label.
NAME and VALUE
Most input elements have a name and an associated value. When the
form is submitted, the names and values of active elements are concate
nated to form the data string. If a submit button is used simply to ini
tiate the submission of the form, its name can be omitted and then it
does not contribute to the data string that is sent. If a name is supplied,
then only the name and value of the button that was actually clicked are
sent. The label is used as the value that is transmitted. Supplying an
explicit
VALUE
will change the default label. For instance, the following
code snippet creates a textfield and two submit buttons, shown in Fig
ure 16 12. If, for example, the first button is selected, the data string
sent to the server would be
Item=256MB+SIMM&Add=Add+Item+to+Cart
.
Item:
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
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