10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

21<br />

CHAPTER 21<br />

Getting Started with Enterprise Beans<br />

This chapter shows how to develop, deploy, and run a simple <strong>Java</strong> <strong>EE</strong> application named<br />

converter. <strong>The</strong> purpose of converter is to calculate currency conversions between Japanese<br />

yen and Eurodollars. converter consists of an enterprise bean, which performs the<br />

calculations, and two types of clients: an application client and a web client.<br />

Here’s an overview of the steps you’ll follow in this chapter:<br />

1. Create the enterprise bean: ConverterBean.<br />

2. Create the application client: ConverterClient.<br />

3. Create the web client in converter-war.<br />

4. Deploy converter onto the server.<br />

5. Run the application client.<br />

6. Using a browser, run the web client.<br />

Before proceeding, make sure that you’ve done the following:<br />

■ Read Chapter 1, “Overview.”<br />

■ Become familiar with enterprise beans (see Chapter 20, “Enterprise Beans”).<br />

■ Started the server (see “Starting and Stopping the Application Server” on page 68).<br />

Creating the Enterprise Bean<br />

<strong>The</strong> enterprise bean in our example is a stateless session bean called ConverterBean. <strong>The</strong> source<br />

code for ConverterBean is in the<br />

tut-install/javaeetutorial5/examples/ejb/converter/converter-ejb/src/java/<br />

directory.<br />

Creating ConverterBean requires these steps:<br />

1. Coding the bean’s business interface and class (the source code is provided)<br />

2. Compiling the source code with the Ant tool<br />

643

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!