Hi all, Here's a nice way to debug the HTML produced by your servlets or PSPs.
Problem: -------- 1. 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). 2. Debugging by hand is tedious, and if posible should be avoided by using HTML validators. 3. 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 Approach: --------- 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. A screenshot is worth 1k words: http://www.opensky.ca/~jdhildeb/webware_validator_screenshot.png Details: -------- 1. 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 2. 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. 3. Add the validateHTML method (available at http://www.opensky.ca/~jdhildeb/webware_validator.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! -- Jason D. Hildebrand [EMAIL PROTECTED] ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
