Using JSP breakpoints
A breakpoint causes the execution of a thread to suspend at the location where the breakpoint is set, only if the breakpoint is set on a debuggable line in the JSP. The following are considered debuggable JSP:
JSP scriptlets (<% ... %>)
JSP expressions (<%= ... %>)
JSP declarations (<%! ... %>)
<jsp:include ... /> tags
<jsp:useBean /> tags
A list of all breakpoints (for all debug sessions) appears in the Breakpoints view, unless you use the filter by debug target action. To filter out breakpoints that are not related to the current debug session, click the Breakpoints view Show Breakpoints Supported by Selected Target push button or right-click in the view and enable the Show Supported Breakpoints pop-up menu item (this menu item is enabled when you select it so that there is a check mark to the left of it).
NOTE: Filtering by debug target does not filter out breakpoints for debug targets that are similar to that of the current debug session.
Breakpoints can be enabled and disabled via their pop-up menus in the Breakpoints view. When a breakpoint is enabled, it will cause a thread to suspend whenever it is hit. When a breakpoint is disabled, it will not cause threads to suspend.
Line breakpoint indicators are displayed in the marker bar in the editor area and in a list in the Breakpoints view. The breakpoint entries in the list provide you, in brackets, with a summary of the breakpoints' properties. Pop-up menu options and push buttons in the Breakpoints view allow you to remove breakpoints.
While in the Breakpoints view, the source editor will open to the location of a breakpoint if you do one of the following:
Double-click the breakpoint.
Select the breakpoint and click the Go to File For Breakpoint push button.
Right-click on the breakpoint and select Go to File from the pop-up menu.
Debugging a JSP file
The debugger enables you to detect and diagnose errors in your application. It allows you to control the execution of your program by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. You can debug a JSP file remotely or locally on WebSphere Application Server without losing the state of your application. To debug a JSP:
In the Navigator view, open your JSP file. In a Web project, JSP files are located in the Web Content folder. The page opens in the editor.
Directly to the left of the line where you want to add the breakpoint, double-click the marker bar directly to the left of the line where you want to add the breakpoint or open the marker bar pop-up menu and select Add Breakpoint:
From the JSP file's pop-up menu in the Navigator view, click Debug on Server.... The workbench switches to the Server perspective and the server is launched in debug mode.
In the Debug view, step through the code and make the necessary changes to the JSP file.
Save the JSP file.
Click the Refresh icon in the Web Browser to update the changes. The state of your application is not lost and the server recognizes your changes.
When you launch a debug session for a Web object that is running on a WebSphere Application Server, you can choose to debug in step-by-step mode. This mode offers the greatest amount of control over the debugging process, as your application stops at entry to every Web object loaded by the server, at which point you can step into or over and use other debugging features.
Unlike traditional stepping, which works at the statement level of the language, step-by-step mode works at a much higher level and stops on entry to every Web object loaded by the server. You use step-by-step mode to get to the Web object you want to debug and then use traditional stepping (step into, step over and step return) to control debugging at the statement level.
NOTE: Step-by-step debugging is only supported when debugging Web objects that are running on a WebSphere Application Server version 5.0.
Enabling and disabling step-by-step debug mode
To enable step-by-step debugging, select a WebSphere Application Server debug target, thread, or stack frame in the Debug view, and do one of the following:
Click the Enable/Disable Step-by-Step Debug push button.
Right-click and choose Step-by-Step Debug from the pop-up menu.
If step-by-step debugging is enabled, you can also disable it by doing one of the above. You can disable step-by-step mode by default by selecting the Disable step-by-step mode checkbox in the Step-by-Step Debug dialog box or you can change the default step-by-step mode in the preferences. The default mode is applied when a new debug session is started. Once the debug session is started, you can change the mode via one of the above methods.
If step-by-step mode is enabled, you will be prompted to debug every Web object loaded in the server in the application that you are debugging. If step-by-step mode is disabled, the Web object that you are debugging will continue to run. The debugger will stop at breakpoints if step-by-step mode is enabled or disabled.
If step-by-step filters are being applied, the debugger will stop at every Web object that is not filtered. You can set step-by-step filters through the preferences.
NOTE: Step-by-step debug mode is only supported when debugging Web objects that are running on a WebSphere Application Server version 5.0.