Debugging Servlets using Netbeans

It is possible to execute and debug servlets from within NetBeans. This is done by using the internal Tomcat server that comes with NetBeans.

Try to Debug a file

When you execute a servlet in NetBeans, it will try to start the internal Tomcat. Since Tomcat is running inside of NetBeans, you will be able to set breakpoints in the code and stop execution of the servlet. You will still use the browser to interact with the servlet, but control will return to NetBeans when a breakpoint is encountered.