Tutorials
WebSphereIn this tutorial you will learn about WebSphere V5.0 : Debugging - Scrapbook Page, Create and run code in Scrapbook Page, Scrapbook, Creating a Java Scrapbook Page, Inspecting the result of evaluating an expression, Displaying the result of evaluating an expression and Running an expression
The JDT contributes a scrapbook facility that can be used to experiment and evaluate Java expressions (such as code snippets). Java scrapbook errors are reported in the editor. Snippets are edited and evaluated in the Scrapbook page editor. In the editor you can select a code snippet, evaluate it, and display the result as a string or show the result object in the debugger's expressions view.
The scrapbook allows Java expressions, to be run, inspected, and displayed, under the control of the debugger. Breakpoints and exceptions are active as in a regular debug session.
A VM is launched for each scrapbook page in which expressions are being evaluated. The first time an expression is evaluated in a scrapbook page after it is opened, a VM is launched. The VM for a page will remain active until the page is closed, terminated explicitly (in the debugger or via the Stop the Evaluation button in the editor toolbar), or when a System.exit() is evaluated.
1. From the workbench window, do one of the following:
2. In the Enter or select the folder field, type or click Browse to select the container for the new page.
3. In the File name field, type a name for the new page. The .jpage extension will be added automatically if you do not type it yourself.

4. Click Finish when you are done. The new scrapbook page opens in an editor.

Inspecting shows the result of evaluating an expression in the Expressions view.
1. In the scrapbook page, either type an expression or highlight an existing expression to be inspected. For example: System.getProperties()
2. Either click the Inspect button in the toolbar or select Inspect from the selection's pop-up menu.

3. The result of the inspection appears in the Expressions view, which opens if it is not already visible.
The result can be inspected like a variable in the debugger (for example, children of the result can be expanded).

Displaying shows the result of evaluating an expression in the scrapbook editor.
1. In the scrapbook page, either type an expression or highlight an existing expression to be displayed. For example: System.getProperties()
2. Either click the Display button in the toolbar or select Display from the selection's pop-up menu.

3. The result of the evaluation appears highlighted in the scrapbook editor.
The result displayed is either:

For example:
Type and highlight new java.util.Date() in the editor, and click Display. A result such as (java.util.Date) Tue Jun 12 14:03:17 CDT 2001 appears in the editor.
As another example, type and highlight 3 + 4 in the editor, and press Display. The result (int) 7 is displayed in the editor.

_________________
Author: Mikalai Zaikin. Please Click Here to visit Authors site for any updates and changes to the study notes.