Java Reference
In-Depth Information
elements to be reset to their initial values, as discussed earlier. In each case, the
value attribute of the button defines what appears as the button label.
The following steps enter the code to create an HTML form that calls a servlet.
To Call a Servlet from an HTML Form
1. Enter lines 31 through 39 as shown in Figure 12-7 on page 787.
TextPad displays HTML statements beginning the body and then the form in
the coding window (Figure 12-11). The form is named logonScreen. When
the document is loaded, the userID field in the logonScreen form will have
focus. The form, logonScreen, uses the Post method to send data to the
WebStocks servlet.
onLoad() event
handler sets focus
to userID text box
specifies text
color used in
HTML document
begins body of
HTML document
inserts image
in leftmost
table column
horizontal
rule tag
form action specifies
the address of servlet
that will process
submitted form data
form name
form method
is Post
FIGURE 12-11
2. Enter lines 40 through 67 as shown in Figure 12-7.
TextPad displays HTML statements in the coding window for a text box and
a password text box (Figure 12-12). Each text box is assigned a name and
size attribute. The size attribute defines the displayed width of the text box
in characters.
creates text box
with name userID
creates password
text box with
name password
FIGURE 12-12
 
Search WWH ::




Custom Search