Java Reference
In-Depth Information
Figure 22-3. BuzzInServlet in action
The game show host has access to an HTML form with a POST method, which calls the
doPost()
method. This displays the winner to the game show host and resets the “buzzer”
for the next question. A password is provided; it's hardcoded here, but in reality the pass-
word would come from a properties file (
Storing Strings in Properties and Preferences
)
or a
servlet initialization parameter (as described in
Java Servlet Programming
[O'Reilly]):
<html><head><title>
<html><head><title>
Reset Buzzer
</title></head>
</title></head>
<body>
<body>
<h1>
<h1>
Display Winner
</h1>
</h1>
<p>
<p>
<b>
<b>
The winner is:
</b>
</b>
<form
<form method=
"post"
action=
"servlet/BuzzInServlet"
>
<input
<input type=
"hidden"
name=
"command"
value=
"show"
>
<input
<input type=
"hidden"
name=
"password"
value=
"syzzy"
>
<input
<input type=
"submit"
name=
"Show"
value=
"Show"
>
</form>
</form>
<h1>
<h1>
Reset Buzzer
</h1>
</h1>