An Introduction to JavaServer Faces (JSF) 5

 

 

 

What do we have in this session 5?

  1. Optional Steps: Using NetBeans IDE’s Java Debugger

 

 

Optional Steps: Using NetBeans IDE’s Java Debugger

 

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.

 

Choosing file from NetBeans IDE editor

 

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.

 

Setting the breakpoint from NetBeans IDE

 

Click the Debug Project ( The NetBeans Debug Project button) button in the IDE's main toolbar. A debug session starts, and project welcome page opens in the browser.

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.

 

 

Windows security alert prompt

 

In the browser, enter a number into the form and click the submit button.

 

 

 

 

 

 

 

 

 

 

 

---------------------------------------------------------------------------------------------------------------------

Entering an input into the web form

 

Switch back to the IDE and inspect the UserNumberBean class. The debugger is suspended within the setUserNumber() method.

 

The Java 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.

 

Invoking the Java debug output window within NetBeans IDE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The debugger's variable window with details content

 

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 ( The NetBeans Java Debugger Step Into button) 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).

 

 

 

 

 

 

< JavaServer Faces (JSF) 4 | Java and Friends | JavaServer Faces (JSF) 6 >


JavaServer Faces 1 | JavaServer Faces 2 | JavaServer Faces 3 | JavaServer Faces 4 | JavaServer Faces 5 | JavaServer Faces 6 | JavaServer Faces 7 | JavaServer Faces 8 | JavaServer Faces 9 | Java and Friends