Step 2: Organize Content in a Portal

In this step you will create a Portal and import two web applications into the Portal.

The tasks in this step are:

To Create a Portal File

In this step you will create a Portal file, an XML file with the .portal file extension. The .portal file is the central defining file of a Portal. It refers to all of the major components of the portal: the desktops, books, pages, portlets, etc. When users visit the Portal, they will point their browsers at this file: http://localhost:7001/PortalProj/my.portal.

  1. On the Application tab, right-click the PortalProj folder, and select New-->Portal.
  2. In the New File dialog, in the upper-left pane, confirm that Portal is selected.
    In the upper-right pane, confirm that Portal is selected.
    In the File name field, enter my.portal.

  3. Click Create.

When you create a .portal file, a visual representation of the Portal is displayed in the main work area. The picture to the right shows the main visual components of a Portal.

A desktop is a user-specific view of the Portal content. A Portal can support many desktops. A single Portal might support an employee-specific desktop, a customer-specific desktop, and others, where each desktop exposes different kinds of users to different sets of content. For example, a employee-specific desktop would probably be a wider view of the Portal content compared to a customer-specific view. The employee desktop might include access to sensitive information that the company wouldn't want in the hands of customers or rival companies. Any part of a Portal can be included or excluded from a desktop, including a book, a page, a specific application, or an individual link.

Desktops can also define the look and feel attributes of a Portal. Desktops can be associated with a particular skin which defines the color scheme, fonts, and images used. Desktops also contain a header and footer: you can place images, text, or any web content in these areas to give consistency to the look and feel of a desktop.

A book gives you a way to organize your content and navigation in a hierarchical manner. Books can contain other books or pages. In a browser, a book is rendered as a set of tabs or links. Each Portal contains a main book called by default "Main Page Book".

A page consists of a set of columns and/or windows that organize the actual content of your Portal. You navigate to a page by clicking on an individual tab or a link.

To Add a Page

In this step you will add a second page to the Portal's main book. When the Portal is rendered in a browser, the two pages will appear as two clickable tabs. You add a new page by dragging and dropping the new page into the main work area. You will also set properties on the new page using the Property Editor.

  1. From the Palette tab, drag and drop the Page icon to the area directly to the right of the Page 1 tab.

    (If you do not see the Palette tab, select View-->Windows-->Palette.)

  2. In the main work area, select New Page.

  3. On the Property Editor tab, in the Title property, enter Page 2 and press the Enter key.



    When you enter a value in the Property Editor, note the change that occurs in the main work area: the title of the page has changed from "New Tab" to "Page 2".

  4. Press Ctrl+S to save your work.

To Import Two Web Applications

In this task you will import the source code for two applications into your Portal Project. These two applications are web applications built using WebLogic Workshop's Page Flow technology. To learn more about Page Flow web applications see the Getting Started Tutorial: Web Applications.

  1. On the Application tab, right-click the PortalProj folder and select Import....
  2. In the Import Files to Project 'PortalProj' dialog navigate to and select the portlets folder located in [BEA_HOME]/weblogic81/samples/platform/tutorial_resources/GettingStarted_Portal.

  3. Click Import.

To Place the Web Applications in the Portal

Portlets are windows that surface web applications and other web content. A Portlet can contain content that is as simple as an HTML file or as complex as a large web application. In the following step you will add two Portlets to your Portal, one will surface the login application, the other will surface the favorite color application.

Note that Portlets are automatically created for you whenever you drag and drop new content into the Portal.

  1. On the Application tab, navigate to the file GettingStarted_Portal/PortalProj/portlets/favoriteColor/favoriteColorController.jpf.
  2. On the Application tab, drag and drop the file favoriteColorController.jpf onto the left column of Page 2.

    (Note that each page is by default divided into two columns. These columns are provided as a convenience for arranging your Portal content. To change the number of columns, use the Layout Type property on the Property Editor tab.)

  3. In the Create Portal dialog, click Yes.

  4. In the Portlet Wizard dialog, click Finish.



    Note that a new .portlet file has been created in the favoriteColor folder.

  5. In the main work area, click the tab labeled Page 1.



    On the Application tab, locate the file GettingStarted_Portal/PortalProj/portlets/userLogin/UserLoginController.jpf.
  6. On the Application tab, drag and drop the file UserLoginController.jpf onto the left column of Page 1.

  7. In the Create Portal dialog, click Yes.
  8. In the Portlet Wizard dialog, click Finish.
  9. Press Ctrl+S to save your work.

You now have a Portal that surfaces two web applications.

To Test the Portal

In this task you will test the Portal using the Workshop Test Browser. The Workshop Test Browser can be used to test any web application you build with WebLogic Workshop.

There are two things to note as you test the behavior of the Portal at this point:

  1. The login and favorite color applications do not communicate with one another. In particular, the favorite color application has no way of knowing whether the user is logged in or not.
  2. The favorite color application has no way of remembering a user's favorite color once the user has logged out.

In the next step of the tutorial you will correct both of these problems. You will make the favorite color application accessible only to logged in users and you will provide a way for the favorite color application to store a user's favorite color while the user is logged out.

  1. Click the Start button, shown below.

  2. When the Workshop Test Browser launches, click the Page 2 tab. (Notice that you can access the favorite color application even though you have not logged in.)
  3. Click the Page 1 tab.

  4. Login in with the username / password: weblogic / weblogic.
  5. Once you have logged in, click the Page 2 tab, and select a favorite color.
  6. Log out of the Portal. (Click the Page 1 tab and click logout.)
  7. Log back into the Portal. Click the Page 2 tab. (Notice that the application has failed to remember the favorite color selected since you last logged in.)

Click one of the following arrows to navigate through the tutorial: