The following scenario describes how you can interrupt the execution of a JSP by adding a breakpoint to analyze the state of the page during runtime.
|
Debugging is activated – that is, the server process has been stopped and restarted in debugging mode. |
...
1. Open the source code of the JSP quickCarRentalView.jsp: In the J2EE Explorer, double-click J2EE_QuickCarRentalWeb → webContent → quickCarRentalView.jsp.
2. Display the source code and navigate to the beginning of the loop through the existing reservations. Right-click the left bar of the editor frame above the appropriate line to open the context menu and choose Add Breakpoint.
|
|
3.
To start the J2EE
application in the debugger, you require a launch configuration. Choose
Run
→ Debug... in the main menu.
In the list, select J2EE Application and choose
New.
|
|
4. In the Name field, enter Quick Car Rental.
5. Choose the Browse… button next to the field Enterprise Application Project, select the project J2EE_QuickCarRentalEar, and choose OK.
6. Choose the RadioButton JSP and click the Browse… button next to the field Jsp, select the JSP quickCarRentalView.jsp, and choose OK.
|
|
|
7. The configuration is now complete; you can start the debugger by choosing Debug.
|
|
The SAP NetWeaver Studio automatically switches to the debug perspective. The Web application is started in an external browser and seems to hang. However, if you change back to the SAP NetWeaver Developer Studio, you will see that the application was stopped at the breakpoint and can now be analyzed.
|
|
Key |
Description |
F5: Step Into |
Jumps to the next statement |
F6: Step Over |
The next command is executed without jumping to the current statement<0} |
F7: Step Return |
If you previously chose F5, you can choose F7 to cancel the debugging of the current command |
|
If you want to exit debugging, you must terminate the threads in the IDE. Proceed as follows: |
...
1. In the Debug window, select the top node (QuickCarRental[J2EE Application]).
2. Right-click and choose Terminate from the context menu.
3. Then choose Remove All Terminated from the context menu.
Preparations for Debugging a Servlet