You can build, package, deploy, and run the simplegreeting application using either NetBeans IDE or the Ant tool.
Follow these instructions to build, package, and deploy the simplegreeting example to the Enterprise Server using NetBeans IDE.
This procedure builds the application into the tut-install/examples/cdi/simplegreeting/build/web directory and deploys the contents of this directory to the Enterprise Server.
In NetBeans IDE, select File->Open Project.
In the Open Project dialog, navigate to tut-install/examples/cdi/.
Select the simplegreeting folder.
Select the Open as Main Project checkbox.
Click Open Project Folder.
(Optional) To modify the Printer.java file, perform these steps:
In the Projects tab, right-click the simplegreeting project and select Deploy.
Follow these instructions to build, package, and deploy the simplegreeting example to the Enterprise Server using Ant.
This procedure builds the application into the tut-install/examples/cdi/simplegreeting/build/web directory and deploys the contents of this directory to the Enterprise Server.
This procedure builds and packages the application into simplegreeting.war, located in tut-install/examples/cdi/simplegreeting/dist/, and deploys this WAR file to the Enterprise Server.
In a terminal window, go to this directory:
tut-install/examples/cdi/simplegreeting/ |
Type the following command:
ant |
This command calls the default target, which builds and packages the application into a WAR file, simplegreeting.war, located in the dist directory.
Type the following command:
ant deploy |
simplegreeting.war will be deployed to the Enterprise Server.
In a web browser, type the following URL:
http://localhost:8080/simplegreeting |
The Simple Greeting page opens.
Type a name in the text field.
For example, suppose you type Duke.
Click the Say Hello button.
If you did not modify the Printer.java file, the following text string appears below the button:
Hi, Duke! |
If you commented out the @Informal annotation in the Printer.java file, the following text string appears below the button:
Hello, Duke. |
Figure 18–1 shows what the application looks like if you did not modify the Printer.java file.