Java Reference
In-Depth Information
7. In the Projects tab, right-click the
producerfields
project and select
Deploy.
To Build, Package, and Deploy the
producerfields
Example Using Ant
1. If the database server is not already running, start it by following the instruc-
tions in “
Starting and Stopping the Java DB Server
” on page
43
.
2. In a terminal window, go to:
tut-install
/examples/cdi/producerfields/
3. Type the following command:
ant
This command calls the
default
target, which builds and packages the applica-
tion into a WAR file,
producerfields.war
, located in the
dist
directory.
4. Type the following command:
ant deploy
To Run the
producerfields
Example
1. In a web browser, type the following URL:
http://localhost:8080/producerfields
The Create To Do List page opens.
2. Type a string in the text field and click Submit.
You can type additional strings and click Submit to create a task list with multiple
items.
3. Click the Show Items button.
The To Do List page opens, showing the timestamp and text for each item you cre-
ated.
4. Click the Back button to return to the Create To Do List page.
On this page, you can enter more items in the list.
The
billpayment
Example: Using Events and Interceptors
The
billpayment
example shows how to use both events and interceptors.
The example simulates paying an amount using a debit card or credit card. When the user
chooses a payment method, the managed bean creates an appropriate event, supplies its
payload, and fires it. A simple event listener handles the event using observer methods.