What Happens to the Form Data?

source

The information the user enters in the form is stored in the request object, which is sent from the client to the JSP container. What happens next?

FIGURE 1-2 represents how data flows between the client and the server (at least when you use Tomcat; other JSP containers may work a little differently).

FIGURE 1-2 How Data is Passed Between the Client and the Server

The JSP container sends the request object to whatever server-side component (JavaBeansTM component, servlet, or enterprise bean) the JSP file specifies. The component handles the request, possibly retrieving data from a database or other data store, and passes a response object back to the JSP container. The JSP container passes the response object to the JSP page, where its data is formatted according the page's HTML design. The JSP container and Web server then send the revised JSP page back to the client, where the user can view the results in the Web browser. The communications protocol used between the client and server can be HTTP, or it can be some other protocol.

The request and response objects are always implicitly available to you as you author JSP source files. The request object is discussed in more detail later in this tutorial.