JSP - SPLessons

JSP Debugging

Chapter 37

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

JSP Debugging

JSP Debugging

shape Description

JSP Debugging – It is always challenging task to perform debugging in any technology, Servlets are utilized to transform huge data between the client and server. While performing compilation of the code developer may get an error then sometimes it may be difficult to identify the error, at this time developer will approach a method that tracing method such as by using the System. out. println (“”), this is used to display the output.Following is the syntax to use System.out.println(“”).

System.out.println("Hi SPLessons");

Following is the simple code by using System.out.println();

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:forEach var="counter" begin="1" end="10" step="1" >
   <c:out value="${counter-5}"/></br>
   <% System.out.println( "counter= " + 
                     pageContext.findAttribute("counter") ); %>

When compile the code following is the result will be generated.


The debugger is the tool which shows developer to find the ways to detect the errors such as compile time errors, run time errors, etc…. Here developer may use breakpoints and suspending threads.Following are the list of the debugging tool to debug the code.

The way of debugging the code in JSP and Servlet is same, following is the servlet debugging link.
Servlet Debugging

By Using Comments

JSP Debugging – Comments in your code can help the troubleshooting procedure in different ways. Comments can be utilized as a part of heaps of different routes in the troubleshooting process.The JSP utilizes Java comments and single line (//…) and various line (/* … */) comments can be utilized to briefly evacuate parts of your Java code. In the event that the bug vanishes, investigate the code you just remarked and discover the issue.


shape Key Points

  • JSP Debugging is the way to trace the program.
  • JSP Debugging – A breakpoint is a alert that advises the debugger to incidentally suspend execution the project at one point.
  • The easiest way to trace the program is System.out.println(“”);