Step 1: Create an EAR Project and a Web Application Project
In this step you will create two projects: an EAR project and a Web Application
project. These are the basic building blocks required for designing and testing
a new Workshop for WebLogic web application.
An EAR project configures and stores resources for other components that belong
to it, components such as web applications, EJBs, databases, etc. An EAR project
has two main roles: (1) It is a composite project made up of other projects,
such as web projects, EJB projects, and others. (2) Is it a resource project
containing library modules and JARs which other projects utilize.
The web application project you create belongs to the EAR project.
To Start Workshop for WebLogic and Create a New Workspace
If you haven't started Workshop for WebLogic yet, use these steps to do so.
... on Microsoft Windows
If you are using a Windows operating system, follow these instructions.
From the Start menu, click All Programs > BEA
Products > Workshop for WebLogic Platform 9.2
...on Linux
If you are using a Linux operating system, follow these instructions.
Run BEA_HOME/workshop92/workshop4WP/workshop4WP.sh
(If you have already started Workshop for WebLogic, select File >
Switch Workspace.)
In the Workspace Launcher dialog, click the Browse
button.
In the Select Workspace Directory dialog, navigate to a
directory of your choice and click Make New Folder.
Name the new folder WebAppTutorial, press
the Enter key and Click OK.
In the Workspace Launcher dialog, click OK.
To Create a New Web Project and a New EAR Project
From the File menu, select New > Project.
In the New Project dialog, on the Select a wizard
page, select the node Web> Dynamic Web Project.
Click Next.
In the Project Name field, enter CustomerCare
Place a check mark next to Add project to an EAR.
Confirm that the EAR Project Name is CustomerCareEAR.
Click Finish.
When
you web project is first created, it is displayed in the Package Explorer
view by default. The Package Explorer view shows a logical view of your workspace
and its JAR resources.
The image to the right shows your workspace in the Navigator view. To switch
to the Navigator view select Window > Show View > Navigator.
The Navigator view shows your workspace as it is saved on disk.
There are now two projects in your workspace: the web project CustomerCare
and the EAR project CustomerCareEAR. The two projects
appear as sibling projects, since they are on the same level of the
directory tree. But when the projects are compiled and deployed, the EAR project
CustomerCareEAR is really a container project for the web project customerCare.
The CustomerCare Web Project
The .settings folder: Any directory that begins with a
"." contains code generated by Workshop for WebLogic. You should
not edit the files in this directory.
The build folder contains .class files and other compiled
code. You should not edit the files in this directory.
The src folder contains the web project's JAVA files. These
files are user editable.
The WebContent folder contains the web project's JSP files
and other web-related resources, such as configuration files (in the WEB-INF
folder).
The CustomerCareEAR EAR Project
The .settings and build folders are described
above.
The EarContent folder contains configuration files for
the EAR project.
EarContent/APP-INF/lib: Any JARs in this directory are available
to any project referenced by the EAR project.
EarContent/META-INF/application.xml: Lists
the modules referenced by the EAR, for example, the web application customerCare.
EarContent/META-INF/weblogic-application.xml: List the library
modules referenced by the EAR project. These resources can be used by any
module referenced by the EAR.
To Import Files into Your Web Project
In this step you will import control files into your web project--control files
that provide access to a customer database. An alternative design would locate
these controls in a utility project (File > New > Project > J2EE >
Utilty Project), which would make the controls available to all projects in
the workspace. But for the sake of simplicity and expediency we have placed
the controls directly in the web project.
On the Navigator tab, open the CustomerCare folder.
Open Windows Explorer (or your operating system's equivalent) and navigate
to the directory BEA_HOME/workshop92/workshop4WP/eclipse/plugins/com.bea.wlw.samples_9.2.1/tutorials/resources/webApp/
Watch Out! Don't open the webService folder!
Drag the folders controls and model (located
at BEA_HOME/workshop92/workshop4WP/eclipse/plugins/com.bea.wlw.samples_9.2.1/tutorials/resources/webApp/)
into the Navigator tab directly onto the folder customerCare/src.
Confirm that the following directory and file structure exists before proceeding.
To Add a WebLogic Server Domain
In this step you will point to a server where you can deploy your application.
Note: if you have executed this tutorial before your server
may already contain previous deployments of the tutorial-related projects. Before
proceeding, it is recommended that you either (1) remove
previous tutorial code from your server or (2) create
a new server domain.
Confirm that you are in the Workshop perspective (Window > Show
Perspective > Workshop).
Click the Servers tab.
Right-click anywhere within the Servers tab, and select
New > Server.
In the New Server dialog, select BEA Systems Inc.>
BEA WebLogic v9.2 Server. Click Next.
In the Domain home dropdown, select the location BEA_HOME/weblogic92/samples/domains/workshop.
(Note: if you are using a newly created server domain for this tutorial, then
use the Browse button to navigate to that server domain,
for example, BEA_HOME/user_projects/domains/base_domain.)
Click Next.
In the Available projects column, select CustomerCareEAR.
Click the Add button to move the select project to the Configured
projects column.
Click Finish.
A new server is added to the Servers tab.
You can use the Servers tab to manage your servers
and project deployments as you develop you applications.
To deploy or undeploy a project from a server,
right-click the server and select Add and Remove Projects.
For a more properties, double-click a server.
Click one of the following arrows to navigate
through the tutorial: