Chapter 14. JSP Debugging Techniques

Once a programmer I knew was asked how he approached the problem of debugging his software. He responded, "I try not to put the bugs in in the first place." This is wise and sage advice. Good design and careful review of your code can minimize the need for debugging. However, even the most experienced developer makes coding mistakes. Furthermore, what happens when you are called upon to repair code written by someone else? Some mistakes are obvious and easy to find; others can be much more subtle and offer a real challenge. Many real-world projects miss their deadlines because problems are encountered that are difficult to find and fix. In this chapter, we cover methods and techniques that you can use to find and fix problems in your JSP code.

Problems in code are referred to as bugs. The story behind this term is that in 1945, Grace Hopper, a pioneer computer scientist, found a moth trapped in the relays of one of the earliest computers. She removed the moth and fixed the computer. Thus, the term debugging was coined and has been used to describe fixing computer problems ever since.

Debugging an application involving JSP can be quite a challenge. Developers often need to have an understanding of the various layers that make up the JSP application they are working on, and they need to understand how multiple languages, HTML, Java, JavaScript, and JSP combine to create the page on the browser.

Many people consider debugging to be an art, but as you ...

Get Beginning JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.