Doing "View source" from the browser doesn't work if your page was produced in response to a POST, since your browser may not re-POST the form variables (mozilla doesn't, at least).
Debugging by hand is tedious, and if posible should be avoided by using HTML validators.
You can't use online web validators (which validate a given URL) in the context of a web application, because your web application often requires a session id, which the validator obviously can't send to your server
This approach uses Web Design Group's HTML validator, which can be installed on your local machine (available at http://www.htmlhelp.com/tools/validator/ ).
You hook it up to your servlets so that the HTML output your servlet produces is automatically validated, and the validation output and full HTML source (with highlighted errors) is appended to the normal output and sent to the browser.
Install the WDG offline-validator. In particular, you need the "validate" script which can be called from the command line. Debian users: apt-get install wdg-html-validator
Apply the patch at http://www.opensky.ca/~jdhildeb/webware_validator_streambuffer.patch to webware. This makes it possible to get the accumulated HTML in the response object from within your servlets, before the response has been committed.
Add the validateHTML method (available at http://www.opensky.ca/~jdhildeb/webwarevalidator.py ) to your SitePage, and call it at the end of writeBodyParts (you'll have to override Page.writeBodyParts() if you haven't already done so). validateHTML won't get all the HTML produced by your servlet if you call response.flush() explicitly, so don't do that. :)
Enjoy!
-- JasonHildebrand - 20 Sep 2002