Sun Java System Web Server 7.0 Developer's Guide to Java Web Applications

Creating a Servlet Response Page

Generate the output page within a servlet by writing to the output stream. The recommended generation method depends on the output type.

Always specify the output MIME type using setContentType() before any output commences, as follows


response.setContentType("text/html");