What do we have in this session 5?
The following steps are optional. If you'd like to quickly build the project, skip ahead to The response.xhtml File.
Test whether the above EL expression does in fact call the setUserNumber() method when the request is processed. To do so, use the IDE's Java debugger.
Switch to the UserNumberBean class (UserNumberBean.java). Press Ctrl-Tab and choose the file from the list.
|
Set a breakpoint on the setUserNumber() method signature. You can do this by clicking in the left margin. A triangle red badge displays, indicating a method breakpoint has been set.
Click the
Debug Project (
Note: If a Debug Project dialog displays, select the default 'Server side Java' option and click Debug. If the following Windows Security alert displayed, please dismiss it.
|
In the browser, enter a number into the form and click the submit button.
---------------------------------------------------------------------------------------------------------------------
Switch back to the IDE and inspect the UserNumberBean class. The debugger is suspended within the setUserNumber() method.
Open the Debugger's Variables window (Choose Window > Debugging > Variables, or press Ctrl-Shift-1). You see the variable values for the point at which the debugger is suspended.
In the image above, a value of '7' is provided for the userNumber variable in the setUserNumber() signature. (The number 7 was entered into the form.) 'this' refers to the UserNumberBean object that was created for the user session. Beneath it, you see that the value for the userNumber property is currently null.
In the
Debugger toolbar, click the
Step Into (
)
button. The debugger executes the line on which it is currently suspended. The
Variables window refreshes, indicating changes from the execution.
The userNumber property is now set to the value entered in the form.
In order to stop the debugging session, click the red square icon.
Or select Finish Debugger Session from Debug menu (or Shift + F5).