Troubleshooting tip #4 - Use HTML comments to debug

Many of the times when you are working on a dynamic presentation layer technology such as JSP or RHTML, it is very difficult to debug the code because the HTML is intermixed with the language code. Some IDE’s attempt to help you by providing debugging of presentation layer code but it may not be very effective most of the times. Usually when there is a problem in the presentation layer code (not syntax error but logical error that causes misbehavior of the display) you might scratch your head trying to locate the problem. The best solution would be to diplay the code/value generated by the dynamic code inside HTML comments and view the source to see what is getting generated.

Most of the dynamic presentation layer technology these days have simple API’s that can generate what you want and reduce a lot of HTML code to be handled by yourself (for example the Java Tag Library or the rails API etc.). In such cases troubleshooting would be much more difficult. That’s when you just have to put the code within an HTML comment. And once you are viewing the page in the browser you just have to do a view source and look at the commented HTML to see what the dynamic code has generated. You might get a lot of clue and answer to your problem very easily.

Blink this Troubleshooting tip #4 - Use HTML comments to debug at blinklist.com    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at blogmarks    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at del.icio.us    Digg Troubleshooting tip #4 - Use HTML comments to debug at Digg.com    Fark Troubleshooting tip #4 - Use HTML comments to debug at Fark.com    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at Furl.net    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at NewsVine    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at reddit.com    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at Simpy.com    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at Spurl.net    Bookmark Troubleshooting tip #4 - Use HTML comments to debug with wists    Bookmark Troubleshooting tip #4 - Use HTML comments to debug at YahooMyWeb

      Cosmos

Leave a Comment

authimage


Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.