Java Reference
In-Depth Information
To Build, Package, and Deploy the
encoder
Example Using NetBeans IDE
1. From the File menu, choose Open Project.
2. In the Open Project dialog, navigate to:
tut-install
/examples/cdi/
3. Select the
encoder
folder.
4. Select the Open as Main Project check box.
5. Click Open Project.
6. In the Projects tab, right-click the
encoder
project and select Deploy.
To Run the
encoder
Example Using NetBeans IDE
1. In a web browser, type the following URL:
http://localhost:8080/encoder
The String Encoder page opens.
2. Type a string and the number of letters to shift by, then click Encode.
The encoded string appears in blue on the Result line. For example, if you type
Java
and
4
, the result is
Neze
.
3. Now, edit the
beans.xml
file to enable the alternative implementation of
Coder
.
a. In the Projects tab, under the
encoder
project, expand the Web Pages
node, then the WEB-INF node.
b. Double-click the
beans.xml
file to open it.
c. Remove the comment characters that surround the
alternatives
ele-
ment, so that it looks like this:
<alternatives>
<class>encoder.TestCoderImpl</class>
</alternatives>
d. Save the file.
4. Right-click the
encoder
project and select Deploy.
5. In the web browser, retype the URL to show the String Encoder page for the
redeployed project:
http://localhost:8080/encoder/
6. Type a string and the number of letters to shift by, then click Encode.