Sun Java System Web Server 6.1 SP6 Programmer's Guide to Web Applications

Servlet Data Flow

When a user clicks a Submit button, information entered in a display page is sent to a servlet. The servlet processes the incoming data and orchestrates a response by generating content. Once the content is generated, the servlet creates a response page, usually by forwarding the content to a JSP. The response is sent back to the client, which sets up the next user interaction.

The following illustration shows the information flow to and from the servlet.

ProcedureTo show the servlet data flow

  1. The servlet processes the client request.

  2. The servlet generates content.

  3. The servlet creates a response and either:

    1. Sends it back directly to the client

      - or -

    2. Dispatches the task to a JSP

      The servlet remains in memory, available to process another request.

      Figure 2–1 Servlet Data Flow Steps

      Servlet Data Flow Steps