Viewing Both JSP and Servlet Files During Debugging
Compiling a JSP source file generates a servlet file. You can facilitate
the detection of
JSP errors by debugging the files in parallel, that is, by
setting
breakpoints and stepping through code with both files in
sync. The following
procedure describes how to display the files side by side.
To open a JSP source file and
its generated servlet file:
- In the Explorer, click the
Filesystems tab.
- Select the JSP source file and right-click to
display the contextual menu.
- If the JSP file has not yet been
compiled, that is, the View Servlet action is not enabled,
choose Compile from the
contextual menu.
- Once the
JSP file has been compiled, choose View Servlet from the
contextual
menu.
The Source Editor opens with a view of the generated servlet code.
- With the JSP file still selected in the Explorer window, choose Open
from
the contextual menu. By default, the JSP source file code appears
in a new
tabbed pane of the Source Editor. At this point, you can see
the servlet
code or the JSP code, but not both at the same time.
- Right-click the current view in the editor, and choose Clone View from
the
contextual menu.
This action opens a new Source Editor window with a
view on the same JSP
code.
- In the original Source Editor
window, click the tab to switch to the
alternate servlet
view.
Now you
have two editor windows side by side: one with a view onto the JSP
code, one
with a view onto the servlet code.
Now when you make changes in one view of the JSP page, you can see them reflected
in the other view of the same JSP page.
Alternatively, to get your JSP code and your servlet code to appear side
by side:
- From the main window, choose View
Debugger Window.
- Click the Breakpoints tab, then right-click the JSP breakpoint to
display its contextual menu, and choose Go to Source.
- Right-click the servlet breakpoint directly below the JSP breakpoint to display its
contextual menu, and choose Go to Source. Both the JSP and servlet code now appear in a
single window.
- Right-click one of the tabs and choose Dock View Into
New Single Frame. Now each set of code appears in its own
window where you can move or resize it to appear side by side.
- Right-click the breakpoint line, which appears in pink or blue depending
on whether it has been stopped.
- From the respective contextual menus, select Show code in Servlet or JSP to display the
corresponding breakpoint in each window.
 |
Debug commands apply to the view that has focus at the time the command
is issued. To issue a command on the alternate view, click in that window
to set focus and then proceed with your command. |
Legal Notices