InfoCenter Home >
4: Developing applications >
4.2: Building Web applications >
4.2.1: Developing servlets >
4.2.1.3: Servlet content, examples, and samples >
4.2.1.3.2: Inter-servlet communication >
4.2.1.3.2.1: Forwarding and including data (request and response)

4.2.1.3.2.1: Forwarding and including data (request and response)

When the servlet engine calls the service method of an HTTP servlet, it passes two objects as parameters:

  • HttpServletRequest (the Request object)
  • HttpServletResponse (the Response object)

The servlet communicates with the server and ultimately with the client through these objects. The servlet reads the Request object from a ServletInputStream. The servlet can invoke the Request object's methods to get information about the client environment, the server environment, and any information provided by the client (for example, form information set by GET or POST). The servlet invokes the Response object's setter methods to return the client response. However, if the servlet is part of a servlet chain, it might pass its response object to another servlet for further processing.

Go to previous article: Inter-servlet communication Go to next article: Example: Servlet communication by forwarding

 

 
Go to previous article: Inter-servlet communication Go to next article: Example: Servlet communication by forwarding