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("").
[java]System.out.println("Hi SPLessons");[/java]
Following is the simple code by using System.out.println();
[java]<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head><title>System.out.println</title></head>
<body>
<c:forEach var="counter" begin="1" end="10" step="1" >
<c:out value="${counter-5}"/></br>
<% System.out.println( "counter= " +
pageContext.findAttribute("counter") ); %>
</c:forEach>
</body>
</html>[/java]
When compile the code following is the result will be generated.
[java]
-4
-3
-2
-1
0
1
2
3
4
5[/java]
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.
Setting breakpoints
Stepping through the code
Watch points
Examining the contents of the application
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.
Summary
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("");