Java Reference
In-Depth Information
Figure 21.2 shows the servlet running in a web browser.
FIGURE 21.2
A web page gener-
ated by the
ColorServlet
servlet.
To change the page's color, type a new value into the “Background color of page” text
field and click the Submit button.
Colors are expressed as a # sign followed by three 2-digit hexadecimal numbers (in
Figure 21.2, the numbers are FF, CC, and 99). These numbers represent the amount of
red, green, and blue the color contains, ranging from a minimum of 00 to a maximum of
FF. If you aren't familiar with hexadecimal colors, you can try these out while testing the
servlet:
#FF0000 —Bright red
n
#00FF00 —Bright green
n
#0000FF —Bright blue
n
#FFAAAA —Light red
n
#AAFFAA —Light green
n
#AAAAFF —Light blue
n
#FFCC99 —Butterscotch
n
Using Sessions
One of the most powerful features offered in servlets is support for sessions , a means of
monitoring a user over time as a servlet is being used.
Search WWH ::




Custom Search