I've set a breakpoint in a JSP when running a Tomcat application through IntelliJ IDEA (Ultimate ed.). So far so good, I can step through the JSP as expected.
The problem is: I am unable to resolve Spring model variables such as ${path}
when debugging. Evaluate Expression triggers an error: "Cannot find variable 'path'".
As a workaround I can explicitly reference the model value with <c:set var="testPath" value="${path}">
. That way I can see testPath
in Variables » _jspx_page_context » attributes, but not path
.
I did some tests and it seems to be possible to "influence" the behaviour of the IntelliJ Debugger. By this it is probably possible to implement debugging functionality for JSPs.
Set a Breakpoint Workshop extends the Eclipse debugger to allow you to debug JSP code. To set a breakpoint: Right-click in the gutter of the Source view and select Toggle Breakpoints.
Variable path
is part of the Spring Framework and is set as an attribute to the PageContext, there are only few ways of debbugging such variables.
For me the best solution is to add an expression to your Watches View: pageContext.findAttribute("path")
or _jspx_page_context.findAttribute("path")
It doesn't matter, because both of them point to the same runtime object:
This is only a work-around, and is certainly not best practices. However, if you need something quick and dirty, set another String var to your $path param. The debugger will be able to see that new variable at runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With