CPSC 476 - Java Enterprise Application Development: Homework Assignment 2
CPSC 476 - Java Enterprise Application Development: Homework Assignment 2
CPSC 476 - Java Enterprise Application Development: Homework Assignment 2
Homework Assignment 2
Due September 14
Work through the tutorial Your First Cup: An Introduction to the Java EE Platform
(http://download.oracle.com/javaee/5/firstcup/doc/).
While the tutorial specifies NetBeans 5.5, you can use NetBeans 6.9; see Updates and
Tips below.
One section of the tutorial is particularly difficult to follow. When you reach Creating
the gree tin g. js p Page, save yourself some grief and copy the contents of
example\firstcup\firstcup-war\web\greeting.jsp rather modifying the page step-
by-step as described. Pick up the tutorial again at Defining Page Navigation. You may
wish to do the same for response.jsp, but those instructions are a bit easier to follow.
• In the New Project dialog, the category Web is now Java Web and Enterprise
is now Java EE.
• In the New File dialog, the category Java Classes is now Java.
• The DukesAge class will probably be generated without a default constructor.
• The Projects context menu now says Build or Deploy instead of Build Project or
Deploy Project.
• In Creating the Enterprise Application, there will be no application.xml file
until you Right-click the firstcup module and choose New → Standard
Deployment Descriptor… and click Finish.
• When pasting code, into NetBeans, you may wish to Right-click in the editor
window and select Format to fix the indentation.
• There is no EJB Methods entry in the Right-click popup menu. Instead, you will
see a lightbulb icon in the left margin at the beginning of the
getAgeDifference() method. Left-click the lightbulb and choose Expose
method in remote business interface Dukes Bi r thd ay Be an Re mo te . Note
that the changes described in the next section (Modify
Duk es Bi rt hd ay Re mo te .j ava ) have been made automatically by NetBeans.
• In Setting firstc up -w ar to Support JavaServer Faces Technology, the
servlet URL mapping is now JSF Servlet URL Pattern: on the Categories tab.
There is no Validate XML checkbox.
• Note that the File menu no longer has a Refresh All Files entry. The Projects
pane should be updated automatically.
• When you open faces-config.xml, the XML view is no longer the default.
• Note that the changes described in Adding a Dependency on the Enterprise
Bean Module have been made automatically by NetBeans.
• In Adding An Enterprise Bean Reference, note that the name of the EJB remote
interface is now DukesBirthdayBeanRemote rather than DukesBirthdayRemote.
• Since NetBeans no longer generates default constructors, you will need to add one
to the DukesBDay class. Right-click in the editor window, select Insert Code…
→ Constructor... → Generate.
• In Getting Duke’s Current Age, note that dragging the getDukesAge operation
into the editor no longer works as described. Paste in the code from the tutorial
instead.
• In Configuring the Dukes BD ay Managed Bean, the popup menu is no longer
JavaServer Faces → Add Managed Bean. Instead choose Insert → Managed
Bean… The same applies to adding Add Navigation Rule and Add Navigation
Case in later sections.
• In Preparing the Deployment Descriptor, you will probably find that no
Context Parameters have been defined.
• In Building, Packaging, and Deploying and Running the Example
Application, the “terminal” is a Windows Command Prompt.
• In Building and Packaging first cu p- du ke s- age Using Ant, on Lab
machines type the following to configure the path:
Note that this change applies only in the Command Prompt window where you
typed it. To make the change permanent, you would need to make the change
under the computer’s Advanced system settings.