Oracle® Fusion Middleware Quick Start Guide for Oracle WebLogic Portal 10g Release 3 (10.3.4) Part Number E14246-02 |
|
|
View PDF |
To get started developing a portal, at a minimum, you need to create a portal EAR and a portal WAR. These are just regular EAR and WAR projects that have been configured to include portal libraries and other artifacts.
This chapter includes the following topics:
Section 3.1, "Choosing a Web Application Framework Technology"
Section 3.3, "Creating Your Portal Web Application (WAR) Project"
Before beginning a portal web project, your team needs to choose an appropriate web application framework. WLP supports several web application frameworks, including:
Java Server Faces – Supported in the default WLP portal web application configuration. You can create WLP portlets based on JSF applications.
Apache Struts – Not supported by default. You have to add the appropriate facets to your portal web project to enable Struts. WLP Struts support lets you create Struts portlets based on Struts web applications. See "Apache Beehive and Apache Struts Supported Configurations" in the Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal.
Apache Beehive – Not supported by default. Beehive lets you create Java Page Flow applications, and you can use the WebLogic Portal Portlet Wizard to create Page Flow portlets You have to add the appropriate facets to your portal web project to enable Beehive. See "Apache Beehive and Apache Struts Supported Configurations" in the Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal.
For more information on these web application frameworks, see Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal and Oracle Fusion Middleware Portlet Development Guide for Oracle WebLogic Portal.
To create your EAR project:
Start Oracle Enterprise Pack for Eclipse.
On the left side of the Oracle Enterprise Pack for Eclipse is the Project Explorer view. You use this view to navigate within your projects.
Right-click within the Project Explorer and select New > Portal Ear Project.
Note:
Although other ways exist for creating a new portal ear project, such as File > New > Project... > Portal Ear Project, the path from the Project Explorer is the easiest and most direct.Complete the pages in the wizard as required, using the information provided in Table 3-1.
Note:
Oracle Enterprise Pack for Eclipse includes cheat sheets for developing portal applications, how to use Oracle Enterprise Pack for Eclipse features, developing Java applications, and other topics. To access a cheat sheet from the menu bar, select Help > Cheat Sheets.Table 3-1 New Portal EAR Project Wizard
In this Wizard ... | Select or Enter... |
---|---|
Project name |
This name will become the default base name for several things, such as the portal administration tools URL. For example, if the name is |
Use default |
Deselect this check box. The default location for projects is within your workspace. However, as recommended in Chapter 2, your project should not go within your workspace directory. |
Browse |
Browse to the location where you want to put your EAR project. This should be an empty directory with the same name as the project. Based on the example in Example 2-1, it would be something like Note: Naming your directories with the same root name is not required, but does eliminate ambiguity. You can create any new directories you need by using the Make New Folder button in the Browse For Folder dialog. |
Project Facets page |
By default you get the facets needed for a portal. You can also add other facets such as Collaboration or Analytics. If you do not know if you if need these facets, you can add them later. |
After clicking Finish, click Yes when the dialog asks if you want to open the associated perspective.
Your EAR project is created, but shows an error, as indicated by the red X on the project in the Project Explorer. The Problems view (Figure 3-2) shows EAR projects are required to contain one or more modules.
The error occurs because you have not yet created a WAR project (or other kind of project) in the EAR.
To create your portal web application (WAR) project:
Within the Project Explorer, right-click your project and select New > Portal Web Project.
Complete the pages in the wizard as required.
Table 3-2 New Portal Web Project Wizard
In this Wizard ... | Select or Enter... |
---|---|
Project name |
By default this name is used as the context root of your web application. For example, if you choose a project name of |
Use default |
Deselect this check box. The default location for projects is within your workspace. However, as recommended in Chapter 2, your project should not go within your workspace directory. |
Browse |
Browse to the location where you want to put your WAR project. This should be an empty directory with the same name as the project. Based on the example in Example 2-1, it would be something like |
Add project to an EAR |
Make sure that EAR you created is selected. This adds the WAR as a module within the EAR and clears the EAR's build error. |
Project Facets Page |
Carefully look at the facets list and see what you might need. The default set covers most situations. You can always go back and add and remove facets as needed. |
A datasync project is an optional project that stores general purpose portal services data used in the development of personalized applications and portals. These portal services include User profiles, session properties, and campaigns.
To create the Datasync project:
From the menu bar, click File > New > Datasync Project.
Complete the pages in the wizard as required.
Table 3-3 Datasync Project Wizard
In this Wizard ... | Select or Enter... |
---|---|
Project name |
Name of the Datasync project. |
Use Default |
Deselect this check box. The default location for projects is within your workspace. However, as recommended in Chapter 2, your project should not go within your workspace directory. |
Browse |
Browse to the location where you want to put your Datasync project. This should be an empty directory with the same name as the project. Based on the example in Example 2-1, it would be something like |
EAR Membership |
Make sure that the EAR you created is selected. |
Use a Utility project for application-scoped source code. In particular, for plain Java classes that are shared by other projects that are included in your EAR. The Utility project code is in the EAR's APP-INF/classes
directory. This means it is not a deployed submodule and does not get a <java>
entry in META-INF/application.xml
.
Note:
A submodule can be deployed separately from an EAR, which can significantly improve redeployment time. For more information, see Section 10.5, "Prefer Quicker Redeploys."To create the Utility project:
Within the Project Explorer, right-click and select New > Other.
In the Select a wizard dialog box, select J2EE > Utility Project, and then click Next.
Complete the pages in the wizard as required.
Table 3-4 Utility Project Wizard
In this Wizard ... | Select or Enter... |
---|---|
Project name |
The name of the utility. |
Use Default |
Deselect this check box. The default location for projects is within your workspace. However, as recommended in Chapter 2, your project should not go within your workspace directory. |
Browse |
Browse to the location where you want to put your Datasync project. This should be an empty directory with the same name as the project. Based on the example in Example 2-1, it would be something like |
Add project to an EAR |
Select the appropriate EAR project from the drop-down list. |
Project Facets page |
If you will be writing EJB or Java code that uses the WebLogic Portal APIs, be sure to select the facets that give access to those APIs. |
If you are planning to write any EJBs, you need to create an EJB project. An EJB project requires an ejb-jar.xml
with at least one EJB. If you do not want to create an EJB project now, you can always do it later.
Tip:
EJB projects are also useful for plain Java code because an EJB is deployed as a submodule. Submodules are advantageous because they can significantly improve the time it takes to redeploy. So you might want to create an EJB project even if you are not using EJBs. For more information, see Section 10.5.3, "EJB Projects in a Sub-classloader Deploy Faster."To create an EJB project:
From the menu bar, click File > New > Other.
In the Select a wizard dialog box, select EJB > WebLogic EJB Project.
Complete the pages in the wizard as required.
In this Wizard ... | Select or Enter... |
---|---|
Project name |
The name of your EJB Project. |
Use Default |
Deselect this check box. The default location for projects is within your workspace. However, as recommended in Chapter 2, your project should not go within your workspace directory. |
Browse |
Browse to the location where you want to put your EJB project. This should be an empty directory with the same name as the project. Based on the example in Example 2-1, it would be something like |
Add project to an EAR |
Select the appropriate EAR project from the drop-down list. |
Project Facets page |
If you will be writing EJB or Java code in this project that uses the WebLogic Portal APIs, make sure you select the correct facets to give access to those APIs. Note: The WebLogic EJB Project uses WebLogic EJBGen to generate the Home and Remote interfaces and the |
The new EJB project shows an error until you create at least one EJB. You can create a placeholder EJB for now. For information on how to do this, see Tutorial: Building Enterprise JavaBeans.
If your EJB project depends on code in your Utility project:
In Project Explorer, right-click your EJB project and select Properties.
On the left side of the Properties dialog box, select J2EE Module Dependencies.
Under Available dependent JARS, select your utility JAR.
Click OK.
The following topics provide more detail for creating new portal projects:
"Starting Oracle Enterprise Pack for Eclipse" in Oracle Fusion Middleware Getting Started with WebLogic Portal for Oracle WebLogic Portal.
"Setting up Your Portal Development Environment" in the Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal.
Section 10.5.3, "EJB Projects in a Sub-classloader Deploy Faster"
"Portal EAR Project Wizard" in the Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal
"Portal Datasync Project Wizard" in the Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal
Oracle Enterprise Pack for Eclipse Help > Cheat Sheets > Oracle WebLogic Portal > Develop a Portal application >
Create a portal EAR project
Create a portal Web project
Create a datasync project
Associate the portal Web and portal EAR projects
Associate the datasync and portal EAR projects
Open the Portal Perspective