
If you are not familiar with this style of programming, it is important to
remember that the servlet is invoked to answer a request from the browser.
The servlet must collect all the information from the browser and prepare
an HTML page with the result.
1. The servlet can access parameters sent by the browser through the
HttpRequest object. For example, the method getParameter() returns
the value of a form field:
String word = request.getParameter(“word”);
2. To generate an answer, the servlet uses the HttpResponse object. In the
following example, the servlet sets the MIME type of the result to
text/html (meaning HTML) and it starts printing the page ...