15.4. Example: Showing Raw Servlet and JSP Output

When you are debugging servlets or JSP pages, it is often useful to see the raw HTML they generate. To do this, you can choose “View Source” from the browser menu after seeing the result. Alternatively, to set HTTP request headers and see the HTTP response headers in addition to HTML source, use the WebClient program shown in Section 2.10 (WebClient: Talking to Web Servers Interactively). For quick debugging, another option is available: create a servlet that takes a URL as input and creates an output page showing the HTML source code. Accomplishing this task relies on the fact that the HTML TEXTAREA element ignores all HTML markup other than the </TEXTAREA> tag. So, the original servlet generates ...

Get Core Servlets and JavaServer Pages™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.