Monday, July 2, 2007

Debugging a JSP Page

Here are a few techniques which i use for debugging a JSP Page.

Debugging a JSP Page is not the same as debugging a Java program.
A Java program has is own set of rules.This makes it easy to find the problem.Whereas a JSP is a combination of html tags and java.The html tags behave differently in different browsers.Though the rules are defined the results are unexpected sometime because of browser behavior.Compared to html, JSP has well defined tags, which means there is a end tag for every begin tag.

One of the first thing you have to look when your changes does not get reflected in the JSP Page is if the page is properly deployed.An easy technique to do this is clear the contents of the page, make a copy separately and create an empty page.Deploy this page and view it in a browser.You will see nothing in this page.Copy the contents again and deploy to see the page.You can see the changes made to the page this time.The reason for this is sometimes the JSP container gets the contents from the cache.Hence you were not able to see your changes in the first case.By clearing the contents we reduce the file size.By doing this we force the container not to take the page from cache.

This technique helped me reduce the effort.Hope this is useful.

No comments: