You can use the debugger to detect and diagnose errors
in your application. You can 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 JavaServer
Page (JSP) without losing the state of your application.
About this task
To debug a JSP file on a server:
Procedure
- In the Project Explorer view, open your JSP
file. In a Web project, JSP files are located in the Web Content
folder. Double-click the JSP file, the file opens in an editor.
-
- Verify that you are using the Source page
of the editor. If multiple pages are available for the editor, such
as Design, Source, or Preview page, select the Source page
on the bottom of the editor. If multiple pages are not available,
the editor defaults to a source editor.
- Select a line of code in the editor and double-click
where you want to add the breakpoint in blue area of the marker bar
directly to the left of the line of code.
- From the JSP file's context menu in the Project
Explorer view, click Debug As> Debug on Server. The
workbench switches to the Debug 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. For detailed information
on debugging, refer to the Debugging Java™ applications documentation.
- 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.
Results
Note: If you are running the JSP file on a remote WebSphere® Application Server,
the JSP cache directory must be cleared to force the class file to
be in the correct JSP source debug mode. If the cache is not cleared,
some compiled unchanged JSP files might still be compiled in the previous
JSP source debug mode.