Building the Web Archive

Use this procedure to create a WAR file that contains the Calculator.jsp, the CalcProxy JavaBean, and deployment descriptors – web.xml and web-j2ee-engine.xml. 

Prerequisites

You have created the Web module project CalculatorWeb that contains the CalcProxy JavaBean and Calculator.jsp.

Procedure

Entering a reference to an EJB using web.xml

       1.      In J2EE Explorer, expand the project structure of CalculatorWeb and double-click the web.xml node.

The Developer Studio opens a multipage editor, which allows you to enter descriptions in the standard deployment descriptor web.xml.

       2.      Choose the EJBs tab.

       3.      Select the node EJB References in the left frame and choose Add.

       4.      From the selection list that appears, select CalculatorEjb and confirm using OK.

       5.      Enter the name CalculatorBean for the Ejb Link.

       6.      Save your changes to the deployment descriptor and close the editor.

The EJB Reference enables you to look up the referenced enterprise bean.

Creating a War File

       7.      In J2EE Explorer, select the project node CalculatorWeb and open the context menu.

       8.      Choose Build Web Archive.

The system displays a message to inform you that the build was successful.

       9.      Close the screen with OK.

Result

The Web archive file CalculatorWeb.war has been generated. It contains all the classes, Web resources of the Web module project, and the entries in the deployment descriptors.

Next step:

Now you can assemble the application.