Java Reference
In-Depth Information
This time, the Result line displays your arguments. For example, if you type
Java
and
4
, the result is:
Result: input string is Java, shift value is 4
To Build, Package, and Deploy the
encoder
Example Using Ant
1. In a terminal window, go to:
tut-install
/examples/cdi/encoder/
2. Type the following command:
ant
This command calls the
default
target, which builds and packages the applica-
tion into a WAR file,
encoder.war
, located in the
dist
directory.
3. Type the following command:
ant deploy
To Run the
encoder
Example Using Ant
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 a text editor, open the following file:
tut-install
/examples/cdi/encoder/web/WEB-INF/beans.xml
b. Remove the comment characters that surround the
alternatives
ele-
ment, so that it looks like this:
<alternatives>
<class>encoder.TestCoderImpl</class>
</alternatives>
c. Save and close the file.
4. Type the following commands: