This tutorial helps you learn how to create a portal and portlets using WebLogic Portal in the Workshop for WebLogic workbench. For m ore detailed information about each dialog of the wizards used in this chapter, refer to the.
The tasks described in this chapter are based on those described in Setting Up Your Portal Development Environment, so it is important that you complete that tutorial before starting the tasks described here.
Using the tutorial, you will create a portal and two portlets, create an additional page for the portal, and then place the portlets onto a page of the portal.
The tutorial includes instructions on how to perform these tasks:
In this task you will create a portal for the project that you created in Create a Portal Web Project.
To create a portal, perform these steps:
myPortalWebProject/WebContentdirectory, right-click and then select New > Portal.
The New Portal dialog displays, as shown in Figure 3-1.
As a best practice, you should locate your portal file in a web content directory that is subordinate to the web project directory. The default web content directory name is
WebContent, and is assigned when you use the Portal Web Project Wizard. You can change the name of your web content directory if you wish; for more information, refer to the .
The wizard adds
myPortal.portal to the
WebContent folder in the Portal web project and a view of the portal displays in the workbench, as shown in Figure 3-2.
The created portal includes a desktop, header, footer, book, and page. 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 content to different sets of users. 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 that 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.
You use books 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.
In this task 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 Properties view.
To add a new portal page, perform these steps:
|Tip:||If you do not see the Design Palette tab, select Window > Show View > Design Palette.|
The new page has a default title of “New Page.” To change it, perform these steps:
This portal isn’t very interesting yet, but as a quick test, you will deploy your new portal to the server and view it in a browser window that is contained within Workshop for WebLogic.
Follow these steps:
myPortal.portalin the Package Explorer view and select Run As > Run on Server, as shown in Figure 3-5.
|Tip:||When you select Run On Server, the portal web application is automatically published. Publishing involves copying project files, such as resource and configuration files, to the correct location for the server to locate and use them. Workshop for WebLogic detects whenever a file changes that requires republishing. When this happens, the state of the server changes to Republish. (You can see this reflected in the Servers view.) To republish the application, you can right-click the server in the Servers view and select Publish, select the Publish icon, or select the portal in the Project view and pick Run As > Run On Server.|
Wait while Workshop for WebLogic starts the server, deploys files to the server, and runs the application. While deployment is in process, you can view status messages in the status bar at the bottom of the window.
The results appear in a new tab in the editor view, as shown in Figure 3-6.
|Tip:||You can choose to always use an external web browser to view your portal if you wish. To do so, select Window > Preferences and select General > Web Browser in the property tree; then select the Use external Web browser radio button and pick a browser type from the list. If no browsers appear in the list you can search for available browsers and add them to the list.|
In this task you will create two portlets: a Browser URL portlet and a simple JSP portlet.
To organize your portlets, it’s a good idea to store them in a subfolder in your web content directory.
To create a portlet folder, follow these steps:
WebContentdirectory and select New > Folder.
The New Folder dialog displays, as shown in Figure 3-7.
portletsand click Finish.
Browser portlets, also called Content URL portlets, are basically HTML portlets that use URLs to retrieve their content. Unlike other portlet types that are limited to displaying data contained within the portal project, browser portlets can display URL content that is outside the portal project.
To create the browser portlet, perform these steps:
portletsfolder and select New > Portlet.
The New Portlet dialog displays, as shown in Figure 3-8. The folder for the portlet displays automatically in the parent folder field.
The Finish button is initially disabled; the button enables when you select a valid parent folder and type a portlet name. If you select an invalid portal project in the folder tree on this dialog, an error message appears in the status area near the top of the dialog explaining that the project is not a valid portal project.
myBrowserPortletas the file name for the new portlet.
The Portlet Wizard displays the Portlet Details dialog; Figure 3-9 shows an example.
The Workshop for WebLogic window updates, adding the
myBrowserPortlet.portlet file to the portlets folder and displaying the new portlet in the editor, as shown in Figure 3-10.
JSP portlets reference JSP files. In most cases you can reuse existing JSP files to build portlets from them. JSP portlets are recommended when the portlet is simple and does not require the implementation of complex business logic.
In this task, you will create a simple JSP file and then use that file to generate a portlet.
Follow these steps:
index.jspin the Package Explorer view.
Simple JSP Portletas shown in Figure 3-11.
jsp_portlet.jspfile into the portlets folder.
jsp_portlet.jspand select Generate Portlet from the menu.
Because you are generating a portlet from an existing
.jsp file, the Portlet Wizard goes directly to the Portlet Details dialog; Figure 3-12 shows an example.
Checkpoint: Your WebContent directory should look like the example shown in Figure 3-13.
In this task you will add your new portlets to the portal and view your changes.
Follow these steps:
myPortal.portaltab to display it.
Your result should look like the example in Figure 3-14.
To view the new portlets in a browser, follow these steps:
Your updated portal should look like the example shown in Figure 3-15.
With the completion of this tutorial, you have created a portal, added a portal page, and created two new portlets that can be displayed in the portal. These components are created on your file system in your current workspace.
To learn about creating desktops using the WebLogic Portal Administration console, continue to Assembling a Desktop in Your Staging Environment.