You can build, package, deploy, and run the guessnumber application by using either NetBeans IDE or the Ant tool.
This procedure builds the application into the following directory:
tut-install/examples/cdi/guessnumber/build/web |
The contents of this directory are deployed to the GlassFish Server.
In NetBeans IDE, select File->Open Project.
In the Open Project dialog, navigate to:
tut-install/examples/cdi/ |
Select the guessnumber folder.
Select the Open as Main Project check box.
Click Open Project.
In the Projects tab, right-click the guessnumber project and select Deploy.
In a terminal window, go to:
tut-install/examples/cdi/guessnumber/ |
Type the following command:
ant |
This command calls the default target, which builds and packages the application into a WAR file, guessnumber.war, located in the dist directory.
Type the following command:
ant deploy |
The guessnumber.war file will be deployed to the GlassFish Server.
In a web browser, type the following URL:
http://localhost:8080/guessnumber |
The Guess My Number page opens, as shown in Figure 19–2.
Type a number in the Number text field and click Guess.
The minimum and maximum values are modified, along with the remaining number of guesses.
Keep guessing numbers until you get the right answer or run out of guesses.
If you get the right answer, the input field and Guess button are grayed out, as shown in Figure 19–3.
Click the Reset button to play the game again with a new random number.