It turns out to be surprisingly difficult to debug JSPs.
The error messages are usually very cryptic,
and once your JSP has been translated to Java
the actual problem seems to have very little to do with the original JSP.
There is a good reason for that:
The program that is executing is quite different from the JSP!
Here are a few hints that will help you debug your JSPs.
- Use long variable names,
it makes searching your file much easier,
and it makes for fewer mistakes.
- Check your data files.
Bad data gives hard to understand messages.
- Validate your input data ...
- Go look at the java source files in
You can often find problems by looking at the source that
are not obvious when looking at the JSP.
- Remember to update your .class files in
when you make changes.
If they are not updated,
you get some very hard to understand error messages.
- You need a useBean command when
creating objects of your own classes,
but not when creating objects of built-in classes
(such as ArrayList).
- When trying to diagnose a problem,
make small changes and try the JSP.
Then remove certain lines to see what happens.
Those will help you find where the problem is occurring.
- Look in the Log files after execution.
The log file on Hermes is:
- We don't have a symbolic debugger,
and print statements in your Java will not always return output
to the client.
One way to get more output if you're really stuck is to add
print statements that print to a local file.
- Different JSP engines give different error messages.
Try it on a different platform to see if you get a better message.
Good luck ...