JSP Debugger
At last! A debugger with a sensible approach to JSP (Java Server Pages) debugging!
JspDebug is a tool for debugging JSP (Java Server Pages) scripts. Given
a JSP, it will generate a Java file that's very close to the JSP, and
can be easily debugged using any IDE that has a debugger. The structure
of this Java file is specially designed for ease of debugging. Once the
bug has been found, the fix can be put into the original JSP. Before adding
the fix to the original JSP, the Java file generated by JspDebug can also
be modified to see if a particular fix will solve the problem.
Background
JSP Debugging has been very difficult, to the point that many developers
try to avoid JSP itself due to the debugging difficulties!
JspDebug is not the first tool for helping with JSP debugging.
There are many tools that attempt to help with JSP debugging.
But none of them have proven themselves to be very useful! This is because
they suffer from one of two problems:
- Attempting to debug at the JSP script level. This is not
very useful. If, for instance, a setProperty *
fails, it is not useful to examine it at the JSP script
level. It is necessary to go underneath and look at
individual retrieval and set operations.
- Attempting to debug the Java code generated by
the application server. The Java code generated by
the application servers is designed for
machines, not humans. It is not even human-readable,
much less human-debuggable!
JspDebug was written because of a perceived need for
a tool that
really solved the problem of JSP debugging.
JspDebug takes a new and original approach to JSP debugging.
JspDebug compiles Java Server Pages (JSP) files into easy to debug
Java files, that can be debugged using any Java IDE, by using the
included JspDebug Debug Server.
- While not attempting to debug at the JSP script level,
a close mapping is maintained between the JSP script
and the Java code.
- The Java code for debugging is specially designed
for debugging, instead of using the code
generated by application servers. The
Java code is intuitive, human-readable, and human-debuggable.
Since the JSP technology is standard, any bugs that
show up in an application server should also show up
in the JspDebug generated code, but will be much
easier to debug in this code!
This is a sensible approach that most JSP programmers
can use. A significant advantage of the JspDebug approach is that there
is no complicated setting up of a "remote debugging" session,
and ANY Java IDE can be used!
The Debuggable Java Code
In the debuggable Java code, all the initialization and cleanup
is removed, and taken care of elsewhere, so that it is easy
to understand what is going on!
JSP statements are usually expanded into Java that's very
similar to the original JSP.
For instance, a useBean directive expands into a simple
one line call such as
BeanType bean = (BeanType) _getSessionBean( "bean", BeanType.class );
Similarly, a
jsp:setProperty *
expands into a simple one line call such as
_setProperty1( bean );
But that's not all, because if the
jsp:setProperty
is not working, it won't help to just see that single line!
Instead, the
_setProperty1 method is available to
step into, and there it expands into a number
of easy to understand retrieve-and-set sequences. In case
of a problem, each individual step can be examined to
see what the form
get returned and what the argument
passed to the bean
set was.
Scriptlets are easy to debug with this approach, of course,
because the Java code is just placed in the class as is.
Tag processing is also very simplified so the actions
are easy to understand and debug.
Debugging Extras
During debugging, the String variable
_content is
available. It can be examined or watched in the debugging IDE,
and it will contain the JSP output until the current statement.
While evaluating a tag body, it will contain the
results of the tag body evaluation until the current
statement.
JspDebug also allows fine tuning of its included server's
behavior, to closely match the behavior of your application server.
It can also throw exceptions on various common errors, so in
some cases you may find a bug without even doing any debugging!
Download
To learn more, please visit tha
FAQ page.
Or to just see JspDebug in action and see the kind
of Java files it generates, please download an evaluation
copy from the
download page.