|
|
Creating and Managing Portals
This following topics are included:
Introduction to Portal Development
What is the difference between a portal and a portlet?
More about Personalization Server portals and portlets
Getting Started with the BEA WebLogic Portal
Creating a portlet application
Creating and Administering Portals
Set the WebLogic Server document root
Configure the portal service manager to control portal access
Create a portal web site directory under the server document root
Logging On to the Portal Administration Tool
Using the Portal Administration Tool
Creating a Portal Using the Demo Portal
Building the Acme Demo Portal components
Creating portlets for your demo portal
Associating portlets with your demo portal
Editing your demo portal layout
Editing your demo portal color scheme
BEA WebLogic Portal Framework Files
Introduction to Portal Development
Internet portals are a key part of many eCommerce applications. They provide an entry point to the Internet as well as value-added services such as searching and application integration. Portals can be divided into two major categories:
Examples of MegaPortals include Netcenter and Yahoo! These provide a window to information on the Internet and represent Business-to-Consumer web applications that can be personalized.
Enterprise portals use general-purpose applications in addition to applications specific to the enterprise or industry. These are Business-to-Business web applications, and in many cases share Business-to-Consumer functionality.
The BEA WebLogic PortalTM allows you to quickly assemble both Business-to-Consumer and Business-to-Business portals that require personalized application content on the Internet.
To take full advantage of the BEA WebLogic Portal functionality, you need to know how to:
The BEA WebLogic Portal is a set of Java Server Page (JSP) templates, JSP tag libraries, Enterprise Java Beans (EJB), and tools that allow:
The BEA WebLogic Portal enables web developers to create portal web pages and personalized application content for each portal user. The BEA WebLogic Portal uses JSPs, a part of the J2EE specification, in conjunction with a special library of JSP tags, standard HTML, Enterprise Java Beans (EJB), portal end user and the portal administration tools, and a pre-configured database to store portal component entities.
Portal applications, referred to as portlets, are JSP or HTML pages that create dynamic content that can be personalized for your portal application. This content is organized and displayed in the portal page according to the personalization information stored in the portal's personalization components.
Intelligent portals can act as tour guides to points of interest, tailored for individual user preferences. For example, there are portals that concentrate on collecting and delivering specialized areas of information such as stock trading and finances, emerging technologies, or corporate information. For example, www.boston.com is a specialized news portal and www.schwab.com is a specialized financial portal. Other megaportals provide general channels of information such as health, weather, sports, news, E-mail services, chat rooms, news groups, and so on.
Internet portals are an efficient way to exchange large volumes of information with large groups of people. From the users' perspective, most portals are organized as a hierarchical web site where the main page provides an overview of or links to a set of pages that provide a more detailed view of the data.
Static portals, like many corporate home pages, provide a standard set of information to everyone who visits the site. In contrast, dynamic personalized portals, where the information presented may differ based on who is viewing the portal, represent a far more efficient and targeted way to do business. Well-known examples of dynamic portals include www.amazon.com, www.ebay.com, www.excite.com, and my.yahoo.com. With the Personalization Server, you can quickly build powerful, dynamic portals like these, as well as static ones.
To deploy the BEA WebLogic Portal in a production environment, place the portal database on any SQL-based DBMS for which you have a Java database connectivity (JDBC) driver. SQL scripts are provided to create the necessary tables. For more information, see Getting Started with the BEA WebLogic Portal.
What is the difference between a portal and a portlet?
A portlet is a highly focused channel of information served up by a portal. A portal can contain many of these information channels. For example, an online retail portal could provide a variety of interactive merchandise portlets, each presenting a different specialty category such as mystery books, classical music CDs, and baseball memorabilia.Unlike a static portal page, the deployment of portlets via the Personalization Server gives our online retailer the ability to dynamically respond to customers based on profiles. With this technology, not only can the retailer provide dynamic content, but also the customer can easily select and arrange their e-Commerce portlets.
For example, a returning customer, Samantha, who loves mystery novels and ghost stories could select the "mystery" portlet as central to her standard view of the retailer's home page. This would be done by means of an edit page made available by the retailer. At the same time, the retailer could determine that Sam's purchase choices and portlet selections convey a taste for the unexplained. The Personalization Server lets you incorporate sophisticated rules technology to automatically generate responses to user profiles. A response could be the delivery of specialized information via a portlet. In the case of the mystery hound, our fictitious retailer could offer up recommendations about the latest thrillers and whodunnits on video.
More about Personalization Server portals and portlets
Generally, a main portal page is organized into smaller display areas. Using the Personalization Server, the portal developer can create a main page layout, with flexible methods for determining custom headers, footers, look and feel elements, and the primary content areas.
Pluggable Portlets
The most information-rich part of the main page consists of a set of portlets, laid out in columns. Each portlet is a small content area, provided to display a particular type of information. These portlets are developed especially for each portal and are written in JSP, so there is great flexibility in what can be displayed. There is a standard set of development guidelines, coupled with portal services, to ensure portal and portlets are well-behaved.
The primary way dynamic functionality of the personalization components is made available to portlets is via custom JSP tags resident in tag libraries. These tags hide much of the internal runtime complexity of the Personalization Server, presenting a small, well-defined interface to its functions. Portlets may also access certain types of personalization EJBs directly, using embedded Java to access Personalization Server functionality.
Each portlet may have a series of custom pages with specific functions associated with it, accessed via button clicks on the portlet. An edit page may make available to the user HTML input elements, in which the user can enter data on preferences specific to that portlet. A full page (or pages) version may be brought up to show an arbitrary amount of detail. A help page can be set up. The portlet may also be maximized, minimized, or floated in its own window.
Portal-to-Go
When you install the BEA WebLogic Portal, a complete demo portal is set up for you and ready to run. This ready-made portal-to-go uses the Cloudscape Database Management System (DBMS) to store the Portal Demo data. Use the portal-to-go to quick start your portal development. The Cloudscape database is included with WebLogic Server under a limited evaluation license. Because of the limitations of the Cloudscape database, other databases should be considered. The database stores all of the portal framework information needed to support the portal components.
Portal personalization
Personalization allows you to customize your portals and portlets to serve a specific audience and purpose. The BEA WebLogic Portal supports three levels of personalization, all of which can be administered with web-based tools. The three levels or personalization are as follow:
Personalization includes web-based forms for adding and removing portal content, editing the content layout, and customizing the portal content color schemes. The user personalization information includes user information and general user preferences.
The Acme Demo Portal
The BEA WebLogic Portal includes a fully operational demo portal called the Acme Portal. The demo portal includes the following:
All of JSP pages for the Demo Portal are located in the following installed product directory, public_html/portals/repository.
For the Cloudscape demo portal, you are ready to run this demo immediately after you complete the BEA WebLogic Portal installation.
How to create a portal
A portlet is a JSP page that represents portlet application content displayed in the portal page. The portlet JSP page is responsible for creating the content which is displayed in the portal page.The BEA WebLogic Portal provides several sample portlet applications for practice.
This is done by first adding portlets and portal groups to the portal and then personalizing them.
The graphic images for the demo portal are located in the installed product directory, server/public_html/portals/repository/images.
For more information on portals or portlets, refer to the following:
For information on creating a portal, see Creating and Administering Portals".
For information on building and running a Demo Portal, see the Creating a Portal Using the Demo Portal.
For information on creating a portlet application, see Creating a portlet application.
Where to get more information
You may need to consult the following documentation when using the BEA WebLogic Portal:
Getting Started with the BEA WebLogic Portal
The BEA WebLogic PortalTM is used in conjunction with WebLogic Server 5.1 The JavaServerTM Pages (JSP) tag libraries, portal database, class files, and documentation for the BEA WebLogic Portal are distributed and installed by the BEA Commerce Server setup program and scripts. This document describes the steps you should follow upon completion of the installation process.
When you install the BEA WebLogic CommerceServer, a complete demo portal is set up for you and ready to run. For running the demo portal, see Running the Portal-to-Go.
For development and production systems, the BEA WebLogic Portal components require a SQL-based database to store the portal personalization data. A DBMS such as Oracle 8.0.5 database can be used to store this information. To set up a DBMS, see Running the DBMS.
Running the Portal-to-Go
When you install the BEA WebLogic Portal, a complete demo portal is set up for you and ready to run. This portal-to-go uses the Cloudscape Database Management System (DBMS) to store the Portal Demo data. Use the portal-to-go to quick start your portal development.
To start the portal-to-go demo:
Example: http://mybigbox:7601/exampleportal
You can now use the BEA WebLogic Portal Administration Tool to view the Demo Portal or assemble your own portal as described in Creating and Administering Portals.
Jar files
The following table lists the installed jar files used by the BEA WebLogic Portal. Additional jars support other Personalization Server functionality. These files can be found in the installation lib directory.
Jar File |
Description |
---|---|
.\lib\wljsp.jar |
WebLogic JSP |
.\lib\esportal.jar |
BEA Portal Tag Library |
.\lib\pt_admin.jar |
BEA Portal Tag Library |
.\lib\esjsp.jar |
BEA Utility Tag Library |
.\lib\ |
BEA User (um_-tags.jar) |
.\ejb\portal.jar |
BEA Portal Components |
.\ejb\axiom.jar |
BEA P13n Components |
.\ejb\bridge.jar |
BEA P13n Components |
.\ejb\foundation.jar |
BEA P13n Components |
Developing Portlets
The BEA WebLogic PortalTM enables you to create your own Business-to-Business or Business-to-Consumer Internet portal solution. An integral part of any portal solution is the portlet application. This guide explains what you need to know to create a portlet application including:
To create a portlet application, you should be a J2EE developer with a background in JavaServer PagesTM (JSP), JavaScript and HTML, and have a knowledge of Enterprise Java Beans. Also, as a portlet developer, you need to read this document to learn about the BEA WebLogic Portal framework and you should have experience with configuring and running the WebLogic Server.
What is a portlet?
From the end-user point-of-view, a portlet is a specialized content area that occupies a small 'window' in the portal page. For example, a portlet can contain travel itineraries, business news, local weather, or sports scores. The user can personalize the content, appearance, and position of the portlet according to the profile preferences set by the administrator and group to which the user belongs. The user can also edit, maximize, minimize, or float the portlet window.
The following figure shows how portlets appear in a portal home page:
Figure 2-1 Portlet Homepage View
From a server application point-of-view, a portlet is a content component implemented as a JSP that defines the static and dynamic content for a specific content subject (weather, business news, etc.) in the portal page. The portlet JSP generates dynamic HTML content from the server by accessing data entities or content adapters implemented using the J2EE platform. The Portlet JSP then displays the content in the portal.
Note: All of the portlets in a portal are included in a single HTML page, through the use of the <jsp:include> action.
Figure 2-2 Portal Application Programming Model
The diagram shown above defines the portal application programming model. This programming model includes JSP, JSP tags, JavaBeans, EJBs, data stores, and content management stores. The portlet JSP contains static HTML and JSP code. This JSP code uses application or content specific JSP tags and/or JavaBeans to access dynamic application data through EJBs, content adapters, and legacy system interfaces. Once this data is retrieved, the portlet JSP applies HTML styling to it and the generated HTML is returned in the HTTP request to the client HTTP client.
Creating a portlet application
The portlet application is a JSP that contains code responsible for retrieving personalized content and rendering it as HTML.
Once you have created your portlets, you can associate them with one or more portals. Therefore, you must create your portlet applications before using the Portal Administration Tool to create and define your portal.
Defining the Portlet JSP
The portal treats portlets as components or HTML fragments, not as entire HTML documents. The portal relies on the portlet application to create an HTML fragment for its portlet content. The portal renders the portlet's content in the portal page according to the personalization rules (the row and column position, colors, etc.) for the portal, group, and user levels.
When creating a portlet application, keep the following items in mind to ensure that your portlets run efficiently:
To define your portlet JSP:
Note: You do not need to create a JSP for the portlet title bar because it is included in the BEA WebLogic Portal (public.html/portals/repository/titlebar.jsp). The portlet title bar displays the appropriate portlet titlebar icons and the name of the portlet you defined in the Portal Administration Tool.
Note: Avoid using the following HTML tags in your portlet content page. The HTML generated by the portlet content page is an HTML fragment contained in a larger portal HTML page, not a separate HTML document.
Table 2-2
Layout Attribute Recommendation Content Height There are no restrictions on height as long as the content fits in your portal page. Column Width Take into account that the width of your portlet is controlled by the portal(s) it is associated with. A portal lays out your portlet content in a column based on portal, group, and user personalization rules. As a result, the width of your portlet should be well behaved. Content Wrapping Allow wrapping for all portlet content. Do not use the NOWRAP attribute in table cells. Titlebar Icon Height The image height attribute in titlebar.jsp is set to 20. Titlebar Icon Width The image width in titlebar.jsp is set to 27.
Working Within the Portal Framework
The portal framework consists of JavaServer Pages, JSP tag libraries, EJBs, Java servlets, and other supporting Java objects. The main Java servlet is the Portal Service Manager, referred to as the traffic cop. The Portal Service Manager receives all incoming HTTP requests and dispatches each request to the appropriate destination URL. As a result, all access to your portal pages is controlled by the Portal Service Manager. The following diagram shows where the Portal Service Manager fits in the portal framework.
Figure 2-3 Portal Framework
Extending the PortalJspBase Class
It is recommended that your portlet JSP extend the framework's PortalJspBase Java class. This class contains many convenience methods which perform general tasks for your portlet JSP page, such as accessing session information, the traffic uri, and user login information.
To extend the PortalJspBase class, include the following code at the top of your portlet JSP:
<%@ page extends="com.beasys.commerce.portal.admin.PortalJspBase"%>
Accessing Portal Session Information
The portal session information you can access from the PortalJspBase class are listed in the following table which lists the name, type, and description for each session value. For more information, see the Portal API Documentation.
Session Value Name |
Type |
Description |
---|---|---|
PortalAdminConstants.PORTAL_NAME |
String |
The name of the portal associated with the current request. |
JspConstants.SERVICEMANAGER_SUCCESSOR |
String |
The name of the successor associated with the current session. The successor profile properties are used for those properties not specified by the user. |
JspConstants.SERVICEMANAGER_USER |
String |
The name of the user associated with the current session. |
UserManagerConstants.PROFILE_USER |
Configurable Entity |
The user profile associated with the current request or the session. |
UserManagerConstants.PROFILE_SUCCESSOR |
ConfigurableEntity |
The group profile associated with the current request or the session. |
UserManagerConstantsPROFILE_SUCCESSOR_UID |
Long |
Unique IDs for the configurable Entities. |
UserManagerConstantsPROFILE_USER_UID |
Long |
Unique IDs for the configurable Entities. |
SERVICEMANAGER_USER |
String |
The name of the user associated with the current request. |
You can retrieve the portal session information described above through the following PortalJspBase methods:
You can set the portal session's SERVICEMANAGER_USER and SERVICEMANAGER_SUCCESSOR through the following JspBase methods:
Sending Requests Through the Portal Service Manager
Remember that all HTTP requests and responses are sent to the Portal Service Manager servlet. Therefore, your portlet HTML must refer to the Portal Service Manager's URL for URL links and HTML form processing.
Using URL Links in Your Portlet
If your portlet contains links to a JSP page that is not a portlet, use the following PortalJspBase method to create your URL and to guarantee that the HTTP request is sent to the service manager URL:
public String createURL(HttpServletRequest aRequest, String destination, String parameters)
The destination should be a relative or qualified file location in the form such as example/mytodo.jsp, or /yourportal/example/mytodo.jsp. The path is relative to the documentRoot, as specified in weblogic.properties. Parameters should be a string such as column=4&row=5.
Note: Parameter values should already be encoded as you would for any HTTP request. Example: String parms = "column=" + java.net.URLEncoder.encode("4");
Because of the way the JSP engine handles jsp:forward and jsp:include, you must fixup the relative URLs in your portlet, especially relative links to images. The web browser thinks the root for relative links is the directory in which the Portal Service Manager resides and not your portlet's directory.
To fixup relative URLs use the following ToolsJspBase method:
public static String ToolsJspBase fixupRelativeURL(String aURL, HttpServletRequest aRequest)
where aURL is the destination URL to fix up and aRequest is the current HTTP request. In your JSP page, use the following method to code a 'fixup':
<img src="<%=fixupRelativeURL("images/quote.gif", request)%>"width="50" height="35" border="0">
Note: For the repository feature to work with jsp:include and jsp:forward, use reconcile file to determine the correct location of the file that is included or forwarded.
Example: jsp:forward page=<reconcileFile("login.jsp")%>
HTML Form Processing
If your portlet contains an HTML form, send all requests to the Portal Service Manager and set the destination request parameter.
To process HTML forms:
public String getTrafficURI(HttpServletRequest aRequest)
The following example shows the use of the HTML form action to send a form request to the Portal Service Manager:
<form method="post" action="<%=getTrafficURI(request)%>">
To set the request destination for HTML forms, enter the following code within your form in your JSP page:
<input type="hidden" name="<%=DESTINATION_TAG%>" value="example/mytodo.jsp">
Note: Do not go through the Portal Service Manager for HTTP requests to other servers.
Retrieving the Home Page
The Portal Service Manager sets the home page for each portal in the Portal Framework session information. The home page is registered as an initial argument for Portal Service Manager servlet in weblogic.properties. Use the following PortalJspBase method call to retrieve the home page:
public String getHomePage(HttpServletRequest aRequest)
Retrieving the Current Page
You can also retrieve the current page from the Portal Framework session information by using the following PortalJspBase method:
public String getCurrentPage(HttpServletRequest aRequest)
Note: When you maximize a portlet, the current page changes to fullscreenportlet.jsp.
Setting the Request Destination
When routing a request through the Portal Service Manager, you must specify the destination that should receive the request. The destination can be relative to the current page (portal.jsp, full-screen portlet.jsp, etc.) or a fully qualified path from the document root.
Note: The DESTINATION_TAG constant is available in PortalJspBase.
If your portlet contains links to other portal pages, use the following PortalJspBase method to create your URL and to guarantee that the HTTP request is sent to the service manager URL:
public String createURL(HttpServletRequest aRequest, String destination, String parameters)
The destination should be a relative or qualified file location in the form such as example/mytodo.jsp, or /yourportal/example/mytodo.jsp.
In some cases, you may need to override the request parameter used by the Portal Service Manager. For example, use an override destination if your page contains a form that needs to be validated and forwarded elsewhere after validation. Use the following PortalJspBase method in your JSP page:
public void setOverrideDestination(HttpServletRequest req, String dest)
To set the request destination for HTML forms, enter the following code within your form in your JSP page:
<input type="hidden" name="<%=DESTINATION_TAG%>" value="example/mytodo.jsp">
Tracking User Login Status
You can log the user in or out and track whether a user is currently logged in.
Use the following PortalJspBase method to track the user login status of a portal session:
public void setLoggedIn(HttpServletRequest aRequest, HttpServletResponse aResponse, boolean aBool)
public Boolean getLoggedIn(HttpServletRequest aRequest)
Loading Content from an External URL
According to the JSP specification, a JSP processed by a JSP engine must be relative to the server in which the JSP engine is running, requiring that all of your portlets reside in your portal server and not on an external web site. However, you can use the uricontent tag to download the contents of an external URL into your portlet. If you download the contents of a URL into your portlet, you need to fully qualify the images located on the remote server because the relative links contained within the remote URL will not be found unless fully qualified.
Use the following method to load content from an external URL:
<es:uricontent id="uriContent"
uri="http://www.beasys.com/index.html">
<%
out.print(uriContent);
%>
</es:uricontent>
The sample <es:uricontent> tag is available in public_html/portals/repository/portlets/_uri_example.jsp
Using example portlets
The /server/public_html/portals/repository/portlets directory of the BEA WebLogic Portal contains example portlets. The following table lists the name of each example portlet, its description, and its associated files.
Caution: The example portlets are intended for illustration purposes only and should not be used for production code.
Example Portlet |
Description |
---|---|
_uri_example.jsp |
Demonstrates how to implement the uricontent tag to import contents from another URL on the Internet. |
bookmarks.jsp |
Displays the bookmarks associated to the current user.
|
definedportals.jsp |
Displays the portals defined in the system. Uses the <es:foreachinarray>, <es:simplereport>, and <wl:sqlquery tags>. |
definedportlets.jsp |
Displays the portlets defined in the system. Uses the <es:foreachinarray>, <es:simplereport>, and <wl:sqlquery tags>. |
dictionary.jsp |
Demonstrates how to redirect a portlet to an external site.
|
generic_todo.jsp |
For a complete generic_todo.jsp example, see Using the Default Implementation. |
news_index.jsp |
Demonstrate use of <cm:> tags. |
news_viewer.jsp |
Display content driven from content_index.jsp. (Use in conjunction with content_index.jsp.). |
grouptodo.jsp |
Displays a Group To Do List.
|
mytodo.jsp |
Displays a "My To Do List."
|
quote.jsp |
Demonstrates how to redirect a portlet to an external site.
|
search.jsp |
Demonstrates how to redirect a portlet to an external site.
|
The following example shows many of the defined method calls and tags mentioned in this document. Each tag is a file in the default implementation directory portals/repository/portlets, named generic_todo.jsp. The bean associated with this file is example.portlet.bean.TodoBean. The source of the bean is in <install-dir>/src/. Using these files, you can recreate each example in your JSP file.
<%--
Set up the tag libraries for tag references. Also have the page extends PortalJspBase, so that you can have access to helper methods.
--%>
<%@ taglib uri="lib/esjsp.jar" prefix="es" %>
<%@ page extends="com.beasys.portal.admin.PortalJspBase"%>
<jsp:useBean id="todoBean" class="example.portlet.bean.TodoBean" scope="request"/>
<jsp:setProperty name="todoBean" property="*"/>
<%
// Get the user name out of the session
String owner =
(String)getSessionValue(com.beasys.portal.tags.PortalTagConstants.PORTAL_USER, request);
%>
<%-- Use the preparedstatement tag to execute a query --%>
<es:preparedstatement id="ps" sql="<%=todoBean.QUERY%>" pool="jdbcPool">
<%
todoBean.createQuery(ps, owner);
java.sql.ResultSet resultSet = ps.executeQuery();
todoBean.load(resultSet);
%>
</es:preparedstatement>
<%
String target = request.getParameter("target");
// Use this method to validate that the request that is being
// processed is actually for this jsp page.
if ( target != null && target.equals(getRequestURI(request)))
{
%>
<es:preparedstatement id="ps" SQL="<%=todoBean.UPDATE%>" pool="jdbcPool">
<%
todoBean.process(request, owner, ps);
%>
</es:preparedstatement>
<%
}
// Get the enclosing window out of the session
// Get the current page out of the session.
// For this example, this value will be the
// fullscreenportlet.jsp (with args) or portal.jsp.
String value = getCurrentPage(request);
%>
<%--
set the action on the form to send the post back to the 'traffic cop'
--%>
<form method="post" action="<%=getTrafficURI(request)%>">
<table width="100%" border="1">
<tr>
<td>
<table width="100%" border="0">
<%
String[][] results = todoBean.asTable();
%>
<%--
Use the foreachinarray tag to iterate over the query results.
--%>
<es:foreachinarray id="nextRow" array="results" type="String[]">
<TR>
<td width="10%">
<div align="center">
<input type="checkbox" <%=nextRow[0]%> name="<%=todoBean.CHECKBOX+nextRow[2]%>" value="ON">
</div>
</td>
<td width="10%" align="center"><%=nextRow[1]%></td>
<td width="80%"> <%=nextRow[2]%></td>
</TR>
</es:foreachinarray>
</table>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="submit" name="updateButton" value="Update">
</div>
</td>
</tr>
</table>
<input type="hidden" name="owner" value="<%=owner%>">
<%--
Tell the 'traffic cop' that you want the post to come back to this page.
--%>
<input type="hidden" name="<%=DESTINATION_TAG%>" value="<%=value%>">
<%--
Use getRequestURI(request)to get this page's name and location.
Also use it if you want to verify that the request is for this page,
by setting a param for the target.
--%>
<input type="hidden" name="target" value="<getRequestURI(request)%>">
</form>
Creating and Administering Portals
The BEA WebLogic Portal Administration Tool contains a complete set of functions that enable Portal Administrators to easily create and update BEA WebLogic Portal database schema entities. With the HTML-based, graphical user interface tool, you can build and assemble the components of a portal page and personalize the portal's content, layout, and appearance.
To properly create and administer a portal using the Portal Administration Tool, you should know how to configure and run the WebLogic Server, set up database connections, and set up portal service providers.
The following topics explain how to create and administer a portal using the BEA WebLogic Portal Administration Tool.
Setting Up
Before using the Portal Administration Tool to create and administer a portal, you must install and setup the BEA WebLogic Portal software.
You must also complete the following three tasks before you can to log on to and use the tool:
Set the WebLogic Server document root
In the weblogic.properties file, set a WebLogic server document root in your preferred Web publishing root directory. Example:
weblogic.httpd.documentRoot=yourDocumentRoot
Following is an example of the weblogic.properties file:
weblogic.httpd.register.exampleportal=com.beasys.commerce.portal.admin.PortalServiceManager
weblogic.httpd.initArgs.exampleportal=\
portalname=exampleportal,\
homepage=/portals/repository/portal.jsp,\
defaultdest=/portals/repository/portal.jsp,\
workingdir=/portals/repository/,\
groupname=AcmeUsers,\
sessioncomparator=com.beasys.commerce.portal.admin.PortalSessionComparator,\
refreshworkingdir=120,\
repositorydir=/portals/repository/,\
timeout=99999,\
allowautologin=false
Configure the portal service manager to control portal access
The Portal Service Manager (PSM) controls user access to your portal. It is a Java servlet that all portal framework HTTP requests must be sent to. Among other functions, the PSM:
You must register an instance of this servlet in the weblogic.properties file for each portal you deploy. The following is a sample PSM servlet registration for a portal named myPortal.
weblogic.httpd.register.myPortal=com.beasys.portal.admin.PortalServiceManager
weblogic.httpd.initArgs.myPortal=\
portalname=myPortal,\
homepage=/portals/myPortal/portal.jsp,\
groupname=everyone,\
defaultdest=/portals/myPortal/_userlogin.jsp,\
timeout=999999,\
workingdir=/portals/myPortal/,\
allowautologin=true
refresh working dir =-1,\
repositorydir=/portal/Repository/,\
sessioncomparator=com.beasys.commerce.portal.admin.Portalsessioncomparator,\
The table below lists valid parameters for your initial registration of the PSM servlet.
Parameter Name |
Required |
Description |
---|---|---|
portalname |
Yes |
The name given to the portal you created in the Portal Administration Tool. Example: Demo Portal |
homepage |
Yes |
The home page JSP returned by the system in auto-login or from the portal home button. (This page is qualified from yourDocumentRoot as defined in the weblogic.properties file.) Example: homepage=/portals/myPortal/portal.jsp |
groupname |
Yes |
The default group name for this portal instance. (When new users register, they are added to this group. This parameter allows you to register two Portal Service Managers that are alike except for the groups that they service.) This value defaults to everyone. |
defaultdest |
Yes |
The default destination page JSP if there is not a valid session for the user. (This page is qualified from yourDocumentRoot as defined in the weblogic.properties file.) To display a default portal page for anonymous users, use: defaultdest=/portals/myPortal/portal.jsp or to force anonymous users to the login page instead of the portal page use: defaultdest=/portals/myPortal/_userlogin.jsp |
timeout |
No |
Timeout for the cookies or session valued in seconds and defaulting to (-1). If set to (-1), the cookies expire upon exiting the browser. If cookies are disabled, the session invalidates upon browser exit. To retain user login information between browser sessions, set the timeout to a large positive number, such as 999999, and set autologin=true. |
workingdir |
Yes |
The working directory JSP for the portal implementation that tells the portal framework where to find your portal pages and the BEA WebLogic Portal pages.(This page is qualified from yourDocumentRoot as defined in the weblogic.properties file.) Example: workingdir=/portals/myPortal/ |
allowautologin |
No |
Determines whether a client with valid cookies can automatically login. The default is false. |
repositorydir |
Yes |
Location of default files, (gifs, JSP, etc.) |
refresh workingdir |
No |
Number of seconds, defaults to -1, which means check every time. |
sessioncomparator |
Yes |
How to determine if the session is valid. |
For more information on weblogic.properties servlet registration, see http://www.weblogic.com/docs/admindocs/properties.html#http.
Create a portal web site directory under the server document root
As a final step before using the Portal Administration Tool, create a web site directory for your portal pages under your WebLogic server document root. Then copy all the files from the portal 'quick start' directory to your portal web site directory.
To copy files from the portal 'quick start' directory to your web site directory:
yourDocumentRoot/portals/repository
to
yourDocumentRoot/portals/myPortal
For example, if your server document root is public_html and your portal working directory is /portals/myPortal/, create the following workingdir:
public_html/portals/myPortal/
Directory |
Description |
---|---|
/portals/repository |
The portal root directory that contains pages such as header.jsp, footer.jsp, and portalcontent.jsp. See Appendix A, BEA WebLogic Portal Framework Files, for an explanation of these and other JSP files provided with the portal framework. |
/portals/repository/images |
A directory of images that support your portal and BEA WebLogic Portal components. |
/portals/repository/portlets |
The directory of all portal JSP and HTML pages and the BEA WebLogic Portal sample portlet applications. |
/portals/repository/portlets/images |
A directory of images that supports your portlets and BEA WebLogic Portal portlets. |
Logging On to the Portal Administration Tool
Once you have prepared the WebLogic server document root, configured the Portal Service Manager, and created web site directory, you can log on to the Portal Administration Tool.
To log on to the P13N Administration Tool:
Note: All administration tools must be accessed through the JSP Service Manager servlet.
A dialog box appears and prompts you to enter a username and password.
Figure 2-4 shows the Administration Tool home page.
Using the Portal Administration Tool
Figure 2-4 Administration Tool Home Page
Now that you have access to the Portal Administration Tool, you can use it to administer portlets, portals, and business-to-business portal groups. Administrative functions available in the tool include:
To the portal framework, a portlet is a JSP page that knows how to retrieve specialized content and display it in the portal application. To users, a portlet is one of many content modules on a portal page that can be personalized to reflect appearance, content, and layout preferences. Once a portlet is created in the Portal Administration Tool, it can be associated with multiple portals.
You can create, edit, and delete portlets in the Portlets section of the Portal Administration Tool home page. All screens in the Administration Tool related to portlet functions are color-coded with teal banners and command buttons. Screens related to portal functions display tan banners and command buttons.
A portlet includes two required components, a titlebar and content area, and several optional components including the banner, header, footer, edit URL, alternate header, alternate footer, maximized URL, and help URL as shown in the following graphic:
Figure 2-5 Portlet Application Decomposed by Components
You can define each portlet application to include any of the following attributes:
The fullscreen page uses:
Figure 2-6 Content Display Criteria
Before you use the Portal Administration Tool to create a portlet, place all your portlet application files in the following directory:
yourDocumentRoot/portals/repository/portlets
You create a portlet in the Administration Tool by creating a portlet definition entity (referred to in this document as a portlet) and associating portlet JSP URLs that have been created by a portlet developer with the portlet entity. When a portlet is created, it is not automatically associated with a portal. You need to add portlets to a portal later from the portal view-page.
To create a portlet:
<%@ page extends="com.beasys.portal.admin.PortalJspBase"%>
<%@ page import="com.beasys.portal.tags.PortalTagConstants"%>
<center>
<font size=-1>To Do's for
<%@ (String)getSessionValue(PortalTagConstants.PORTAL_GROUP,request)%></font>
</center>
If the portlet was successfully created, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing Portlets
After creating a portlet, you can redefine it at any time by adding or removing attributes.
To edit a portlet:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Deleting Portlets
You can delete portlets that you no longer need. However, you must first remove (mark as unavailable) the portlet from any portals it is associated with.
To delete a portlet:
Administering portals
You can create, edit, or delete portals from the Portals section of the Portal Administration Tool home page. All screens in the Administration Tool related to portal functions are color-coded with tan banners and command buttons. Screens related to portlet functions display teal banners and command buttons.
For procedures on using the Demo Portal components to quick-start your portal development, see Creating a Portal Using the Demo Portal.
Creating Portals
To create a new portal:
If the portal was successfully created, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing Portals
After creating a portal, you can edit it to associate portlets, groups, and users. You can also personalize the portal's layout and color scheme, and make changes to the definition.
To edit a portal:
The following image shows the portal view-page.
Figure 2-7 Portal View Page
Editing Portal Definitions
You can edit the portal definition you created to reflect any changes to the associated URLs or number of portal columns.
To edit a portal definition:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Adding and Removing Portlets
You can choose which portlets are available to a portal by adding and removing them from the system's list of all established portlets. From the narrowed list of portlets you associate with a portal, group, and end-users further define which portlets they want available and visible on their personalized portal page.
To associate portlets with a portal:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing Portlet Display Attributes
Portlet titles, associated with a portal, display as hot links in the Associated Portlets section of the portal view-page. These links open a tool that enables you to further specify how the portlet displays in the portal, overriding the display attributes established when the portlet was created. Group Administrators can further personalize these attributes.
To edit an associated portlet's display attributes:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing the Portal Layout
You can move a portal's associated portlets left and right between columns and up and down within columns depending on the column layout you selected when you created the portal. You can also change the percentage of the portal page that each column occupies. Group Administrators and end-users can further personalize the portal layout.
To edit the layout of portlets in a portal:
To change the column spans of a portal layout:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing the Portal Color Scheme
You can edit the overall appearance of a portal by changing its background color as well as the portlets' component colors, title colors, and border appearance.
To edit portal colors:
Associating Groups with a Portal
You can only associate portal groups from the portal view page. For more information on associating users with a group and personalizing portal groups, see Administering portal groups.
To associate a group with a portal:
To disassociated with a group:
Deleting Portals
You can delete an existing portal from the Portal Administration Tool home page. However, you must first disassociate all portal groups and users from that portal.
To delete a portal:
Administering portal groups
The Portal Administration Tool enables you to personalize portal groups. You can personalize the layout, content, and color scheme.
Avoid creating portal groups for business-to-consumer portals with an unmanageable number of users.
You can edit portal groups from the portal view-page.
Editing Portal Groups
Editing portal groups allows you to associate portlets with each group. You can also personalize the group's portal layout and color scheme.
To edit a portal group:
Adding and Removing Portlets from a Portal Group
As the Group Administrator, you choose which portlets are available to a group by adding and removing them from the portal's list of all associated portlets. From the narrowed list of portlets you associate with a group, end-users further define which portlets they want available and visible on their personalized portal page.
To associate portlets with a group:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing the Portal Group Layout
You can move a group's associated portlets left and right between columns and up and down within columns. End-users can further personalize the portal layout.
To edit the layout of portlets in a group:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing the Portal Group Color Scheme
You can edit the overall appearance of a group by changing its portal background color as well as the portlets' component colors, title colors, and border appearance.
To edit group colors:
Testing Your Portal
Once your portal is operational, you should test it to verify that all the associated portlets are available and visible as you specified them, and that your portal displays the correct color scheme and layout.
To test your portal:
The default portal home page should display all visible portlets and should reflect your default color and layout preferences.
If you have not created a user profile, you can do so by following the registration wizard. If you have created a profile, enter your username and password, and click sign on.
You can now use the personalization tools to customize the portal's color, layout, and visible portlets.
Creating a Portal Using the Demo Portal
The following sections show you how the ACME Demo Portal data could be manually, entered, using the administration tools. The BEA WebLogic Portal installation package includes a Portal Service Manager for the Demo Portal. You can find it in the weblogic.properties file. The Portal Service Manager property name is exampleportal and maps to the Demo Portal EJB component.
Before using the Portal Administration Tool to Assemble the Acme Demo Portal, you must install and set up the BEA WebLogic Portal software. For more information, see Getting Started with the BEA WebLogic Portal.
You must also set the WebLogic server document root before you are able to log on to and use the tool. For more information, see Getting Started with the BEA WebLogic Portal.
For more information on accessing and using the Administration Tool, see Logging On to the Portal Administration Tool.
Building the Acme Demo Portal components
To create the Demo Portal definition:
Field Name |
Data |
---|---|
Portal Name |
Demo Portal |
Header URL |
header.jsp |
Content URL |
portalcontent.jsp |
Footer URL |
footer.jsp |
Number of columns |
3 |
Suspend |
Defaults to false. Set to true to suspend the portal during maintenance. |
Suspended URL |
Enter suspended.jsp if you want to display the under maintenance URL during maintenance. |
If the portal was successfully created, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Creating portlets for your demo portal
You create portlets in the Administration Tool by associating a URL with each portlet component. When a portlet is created, it is not automatically associated with a portal. You must add the portlets to the demo portal later from the portal view-page.
The Acme Demo Portal includes six portlet applications that you can assemble with the Portal Administration Tool.
To create the demo portlets:
Portlet Name |
Data |
---|---|
Bookmarks |
Portlet Name: Bookmarks |
|
Content URL: portlets/bookmarks.jsp |
|
Editable: select the check box |
|
Edit URL: portlets/bookmarks_edit.jsp |
|
Maximizable: select the check box |
|
Icon URL: portlets/images/pt_bookmark.gif |
|
Login Required: select the check box |
|
Titlebar URL: Enter a URL to display as the portlet titlebar. It can be a JSP or HTML fragment. |
|
Mandatory: A mandatory portlet is one that is always available and visible. |
If the portlet was successfully created, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Portlet Name |
Data |
---|---|
My Dictionary |
Portlet Name: My Dictionary |
|
Content URL: portlets/dictionary.jsp |
|
Icon URL: portlets/images/pt_dictionary.gif |
|
Minimizable: select the check box |
My To Do List |
Portlet Name: My To Do List |
|
Content URL: portlets/mytodo.jsp |
|
Editable: select the check box |
|
Edit URL: portlets/mytodo_edit.jsp |
|
Maximizable: select the check box |
|
Icon URL: portlets/images/pt_my_list.gif |
|
Minimizable: select the check box |
|
Floatable: select the check box |
|
Login Required: select the check box |
My Group To Do List |
Portlet Name: My Group To Do List |
|
Content URL: portlets/grouptodo.jsp |
|
Banner URL: portlets/grouptodobanner.jsp |
|
Editable: select the check box |
|
Edit URL: portlets/grouptodo_edit.jsp |
|
Maximizable: select the check box |
|
Icon URL: portlets/images/pt_group_list.gif |
|
Minimizable: select the check box |
|
Floatable: select the check box |
|
Login Required: select the check box |
Stock Quote |
Portlet Name: Stock Quote |
|
Content URL: portlets/quote.jsp |
|
Icon URL: portlets/images/pt_quote.gif |
|
Minimizable: select the check box |
Search |
Portlet Name: Search |
|
Content URL: portlets/search.jsp |
|
Icon URL: portlets/images/pt_search.gif |
|
Minimizable: select the check box |
News Index |
Portlet Name: News Index |
|
Content URL: portlets/new_index.jsp |
News Reader |
Portlet Name: News Reader |
|
Content URL: portlets/news_viewer.jsp |
|
Titlebar: content_titlebar.jsp |
Associating portlets with your demo portal
After creating a portal, you can associate portlets to it. You can also personalize the portal's layout and color scheme, and make changes to the definition. For more information on editing a portal, see Editing Portlets.
You choose which portlets are available to a portal by adding and removing them from the system's list of established portlets. From the narrowed list of portlets you associate with a portal, group and end-users further define which portlets they want available and visible on their personalized portal page.
To associate the six portlets you just created with the demo portal:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing your demo portal layout
You can move a portal's associated portlets left and right between columns and up and down within columns depending on the column layout you selected when you created the portal. You can also change the percentage of the portal page that each column occupies in all portals except group portals. Group Administrators and end-users can further personalize the portal layout.
To edit the layout of portlets in the demo portal:
To change the column spans of a portal layout:
If the changes were successfully made, a confirmation message appears in red at the top of the screen. If not, an error message notifies you of the required changes.
Editing your demo portal color scheme
You can edit the overall appearance of a portal by changing its background color as well as the portlet's component colors, title colors, and border appearance.
To edit the demo portal colors:
Testing Your Demo Portal
Once your portal is operational, you should test it to verify that all the associated portlets are available and visible as you specified them, and that your portal displays the correct color scheme and layout.
Figure 2-8 Acme Demo Portal
To test the demo portal:
The default portal home page should display all visible portlets and should reflect your default color and layout preferences.
If you have not created a user profile, you can do so by following the registration wizard. If you have created a profile, enter your username and password, and click sign on.
You can now use the personalization tools to customize the portal's color, layout, and visible portlets.
Figure 2-8 shows the Acme Demo Portal as it displays with the BEA default color scheme and layout to a registered user named jsmith.
BEA WebLogic Portal Framework Files
The following table displays the names and functions of the template JSP files provided with the BEA WebLogic Portal framework. Each of these files is located in the root directory of the portal which it serves, such as /portals/repository.
JSP File Name |
Function |
---|---|
_user_add_portlets.jsp |
The tool employed by the end user to add/remove portlets. |
_user_layout.jsp |
The tool employed by the end user to update portlet layout. |
_userlogin.jsp |
The user login page. |
_userreg.jsp |
The new user registration page. |
_userreg_summary.jsp |
The user profile summary page. |
alternatefooter.jsp |
The footer displayed when a portlet is maximized or detached. |
alternateheader.jsp |
The header displayed when a portlet is maximized or detached. |
baseheader.jsp |
A stripped version header.jsp, intended for general use beyond the portal home page. |
color_picker.jsp |
The color palette employed by the user color preferences tool. |
error.jsp |
A general-purpose page used for displaying run-time errors. |
error_footer.jsp |
The footer displayed with error.jsp. |
error_header.jsp |
The header displayed with error.jsp. |
footer.jsp |
The footer displayed with the main portal page. |
fullscreenportlet.jsp |
The page used to display a maximized or detached portlet. |
gen_prefs.jsp |
The tool employed by the end user to update general user profile information. |
header.jsp |
The header displayed with the main portal page. |
help.jsp |
The end user help page. |
layout_script.jsp |
The JavaScript used by the end user layout tool. |
portal.jsp |
The main portal page. |
portalcontent.jsp |
The page which prescribes portlet layout within the main portal page. |
portalerror.jsp |
The default error page displayed when an access attempt to a portal page fails. |
portalnotexist.jsp |
The page which displays a general message indicated that the requested portal does not exist. |
portlet.jsp |
The page which constructs a portlet, combining portlet titlebar, banner, header, content, and footer. |
privacy_policy.jsp |
A placeholder for a company privacy policy statement. |
status.jsp |
The page used to display end-user status messages. |
suspended.jsp |
The page which provides a message indicating that the requested portal is currently non-operational, typically for maintenance reasons. |
titlebar.jsp |
The portlet titlebar. Contains appropriate portlet icons and portlet name. |
user_colors.jsp |
The end user color preferences tool. |
Internationalization
The BEA WebLogic PortalTM Administration Tool is supported by JSP bean objects which employ Java internationalization standards in the practice of presenting error and status messages. These beans use a BEA utility object called MessageBundle in conjunction with text-based properties files to produce two types of locale-specific display text. The two types of text are as follow:
Properties Files
Properties files are located in two particular directories in the portal framework. The first set of properties files supports the Portal Administration Tool and are located in com/beasys/commerce/portal/admin/jspbeans/i18n.
The second set of properties files supports both the Administration Tool and the run-time portal end-user tools. This set is located in com/beasys/commerce/portal/jspbeans/i18n.
Each properties file that supports a particular bean includes the bean name and a properties extension. For example, the properties file that supports the com.beasys.portal.admin.jspbeans.PortalJspBean bean resides in the i18n directory, and is called PortalJspBean.properties.
Static Text
The BEA WebLogic Portal uses the following convention when naming static text entries in the properties files:
propertyName.txt=propertyValue
For example: error.txt=Error Occurred.
A static text property is acquired from a loaded MessageBundle using the following method:
String messageBundle.getString(String propertyName)
For example: System.out.printin(messageBundle.getString("error.txt"));
For more information, see the Portal API Documentation.
Constructed Messages
The dynamic display text created by internationalization often depends on one or more variables, and the order of these variables in a text segment is locale-specific. In this case, the BEA WebLogic Portal provides a means for constructing message segments for display.
The portal uses the following convention when naming message entries in properties files:
propertyName.msg=propertyValue
For example:
fieldRequired.msg={0} is a required field.
A constructed message is acquired from a loaded MessageBundle using the following method:
String messageBundle.getMessage(Object[ ] args, String propertyName)
For example:
Object[ ] args={"ContentURL"};
System.out.println(args,"fieldRequired.msg");
For more information, see the Portal API Documentation.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|