Most of the content presented to the user as part of a Web application is HTML. These Web pages are easily created and managed using HTML page editors which allow the developer to concentrate on the presentation and content through the use of a WYSIWYG user interface. In previous chapters, we have concentrated on the mechanics of the implementation of server-side logic using servlets. In one example, servlets directly delivered HTML content to the HTTP output stream with string literals in Java. While this gets the job done, few would consider this a best practice.
As an alternative to creating all output on the servlet, one could use the
RequestDispatcher object, available from the
ServletRequest, to include ...