Request Handling

Servlets are request-driven and have specific capabilities available to them that simplify handling of incoming requests.

Recall that a request to a servlet may consist of several pieces of data (for example, when a form consisting of several fields is filled in and submitted).

When the Web container receives a request intended for a servlet, it encapsulates the incoming data into a ServletRequest object (commonly referred to as the request object) and passes it on as a parameter to the servlet's service method. The servlet can then use the methods available in the ServletRequest interface to query the request object. Some of the queries are contained in the following list:

  • getCharacterEncoding obtains information about the encoding ...

Get Developing Enterprise Java Applications with J2EE™ and UML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.