This example displays:
Cookies received from browser:
...
Cookies added:
...
Where ... are cookie key = value pairs.
The Servlet also displays a form that can be used to enter new and modify
existing cookie key, value pairs.
Clicking on Submit sends the values to the Servlet for processing,
clicking on Submit without any values refreshes the form and
clicking on Reset clears the current values in the fields.
This example uses buffered response output in order to be able to set the
cookie value. Cookies must be sent along with the header before any other
output is sent to the client's browser.
[ view source ]
[ run ]
|