Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find a JSP variable in debug mode

In my JSP file I have a property initialized like this:

<c:set var="perspectiveCount" value="0"/>

I am trying to learn how to debug JSP in NetBeans. When I toggle a breakpoint just after that line and debug the program I get a plethora of variables in the Variables tab where I cannot find perspectiveCount. Maybe because it's not exactly a variable, but a property.

I also tried to use Evaluate Code tab, but it answers me "perspectiveCount" is not a known variable in the current context.

What is the correct way to debug and learn the value of perspectiveCount?

like image 365
Limbo Exile Avatar asked Sep 03 '13 12:09

Limbo Exile


People also ask

How do I show variables in debug mode?

Hover over a variable to see its value. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.

How do I show variables in debugging in Eclipse?

Variables/Expression view – Shows the declared variables and their values. Press Ctrl+Shift+d or Ctrl+Shift+i on a selected variable or expression to show its value. You can also add a permanent watch on an expression/variable that will then be shown in the Expressions view when debugging is on.

Can we debug JSP code?

Debug the JSPRight-click in Source view and select Debug As > Debug on Server. The process is the same as for running an application. Note that since the server was started before in non-debug mode, you will be prompted to restart the server. Click OK to restart in Debug mode.


1 Answers

Althought you debug with Netbeans, this might be helpful to others:

On Intellij pageContext appears and dissappears from debug as a local variable. You can relay on _jspx_page_context

then

_jspx_page_context.findAttribute("perspectiveCount") 

will let you debug what you want on Intellij.

like image 175
albfan Avatar answered Sep 28 '22 19:09

albfan