This month we ask David Lection to answer your questions about portlet development techniques and how to use Portal Toolkit with WebSphere® Portal. WebSphere Portal enables you to quickly build scalable portals to simplify and accelerate access to personalized information and applications. David is lead architect for the Portal Toolkit for WebSphere Portal team. For more information, see WebSphere Portal Zone.
We appreciate and thank all the WebSphere developers who submitted questions.
Question: We currently have an application running on WebSphere we would like to port over to portal server. However, our application requires a session object to share information across pages and servlets. Is it possible to do something similar in Portal server to share data between portlets on the same page as well as portlets on different pages, such as storing the timezone offset of the user's browser in order to display times on their page at their local time. (submitted by MG)
Answer: For data security reasons, the session object was made less global in WebSphere Application Server 4.0. That is, it could only be shared by a single Web application. A change was made in WebSphere Portal to also enforce this rule. The session data would be global to only the portlets within a portlet application.
Portlets on the same page can share data either by messages, click 2 action, or by session data as long as they are in the same portlet application (WAR) file. This gets more problematic across pages, again for reasons of performance and data privacy. I believe the rule on session data is that session data should work across pages (I have not tried this myself). However, realize that when a page is not visible, the portlets are not being asked to render. Data values may change. A portlet on a non-displayed page will not see the state change.
Question: I'm new to portal development, so hopefully this question isn't too insipid. I'm wondering if there is any mechanism to catch events at the portal level (as opposed to the portlet level). Specifically, if an end user clicks the logout icon, can I catch that event and, say, redirect that user to a certain Web page? (submitted by Glenn H.)
Answer: You need to check out portlet filters. An installed portlet filter could see the submitted events that result in an action event, before the target portlet gets the event. You want to be sure that re-directing the user to another page is really the best thing to do, because the user is expecting to have the action performed (in this case, logout).
Question: It's a bit frustrating to see these great new pieces of enterprise architecture coming from IBM, but not being able to utilize them in our portal development. When can we expect a version of WPS that IBM officially supports the use of WAS v5, IHS 2.x, DB2 8.1, RH8, etc? (submitted by TR)
Answer: We are working on a version of Portal that runs on WebSphere Application Server V5. I can't announce a specific date. I believe IHS 2.x is compatible with Application Server V5, so it should work. I do not have specific information on DB2® 8.1 and Red Hat V8 support.
Question: I recently uninstalled WPS 4.1.2 and installed 4.2 on the same box I have WSAD 5.0 and the Toolkit 4.2.5. I heard that a WPS Test Environment could be setup via the Toolkit so I uninstalled WSAD and the Toolkit and reinstalled. However, during the install I'm only able to install the Toolkit and not the test environment, it stalls at 8%. Any idea why? I have a Win2000 laptop, WPS 4.2. I'm pointing at the install CD 7 I downloaded from the KNAC, /WPS and /PRZ for the install directories. Any info on how I can get this working would be of great help, thanks. (submitted by Jon Dockter)
Answer: How much memory do you have on your machine? I have seen one other report of the install stalling at 8%, and at the time it seemed the user's machine had 512MB of memory only. When you run the Portal Toolkit 4.2.5 with WebSphere Studio, you need at least 768MB. We recommend 1GB with a 1GHZ processor.
If you have sufficient memory and this error occurs, you need to submit a problem report so we can further diagnose the problem.
Question: In WPS 4.2 there is a new navigation model, Model API. Is there any documentation/examples on this other than the small portion in the 4.2 API? (submitted by Jon Dockter)
Answer: I have not seen any examples. If you email me your email address to email@example.com, I will look further into an example.
Question: I'm trying to put an applet inside a portlet, but the JSP does not find the applet class. I tested it outside Portal, and inside Tomcat, and it worked just fine. I copied the jar and cab file to the portlet directory and generated the war file, but it didn't work. Is there any specific place to put the Applet jar or cab file so that it works properly inside Portal Server? (submitted by AP)
Answer: From the Sun® documentation on the <APPLET> tag:
By default, a browser looks for an applet's class and archive files in the same directory as the HTML file that has the <APPLET> tag. (If the applet's class is in a package, then the browser uses the package name to construct a directory path underneath the HTML file's directory.) Sometimes, however, it's useful to put the applet's files somewhere else. You can use the CODEBASE attribute to tell the browser in which directory the applet's files are located:
<APPLET CODE=AppletSubclass.class CODEBASE=aURL WIDTH=anInt HEIGHT=anInt> </APPLET>
You need to set the CODEBASE parameter correctly. Your JAR file should go into the portlet WAR file in
/lib directory. For the
CODEBASE parameter, specify a relative path to the jar file.
<APPLET CODE="MyPortlet.class" CODEBASE="./lib/portletclasses.jar"></APPLET>
Question: I am trying to set up a PoC using WPS Express v4.1 and am trying to understand what is required to setup a development environment. I am trying to setup WPS Express, WSAD, and Portal Toolkit on one machine and demonstrate creation of portlets and also WPS functionality like web clipping.
I understand the recommended development environment is to use WSAD with Portal Toolkit. From the forum, it seems that WAS v4.0 AEs is required for WSAD and Portal Toolkit. However, Portal Express only comes with WAS v4 AE. Do I need to manually install AEs and then continue with install using setup manager? Or, if I choose the development option in the setup manager, will it allow for Portal Toolkit to be used on the same machine along with WSAD? Also, if I require AEs, will I lose portal functionality in terms of portlets available (such as web clipping) or other functionality? (submitted by KerWin Ng)
Answer: To setup a development enviroment for WebSphere Portal Express, you will need the following software:
- WebSphere Application Server, Single Server Edition 4.04 or later
- WebSphere Studio Application Developer (or Site Developer) 4.03
- Portal Toolkit 4.2.1
- DB2 Universal Database 7.1 or later
You need to install WebSphere Application Server AEs 4.04 on your machine, then DB2, and then run the
Portal Toolkit installer
(not setup manager) to install Portal on WebSphere Application Server AEs. The Portal Toolkit
installer is an
file included in the same directory as the portal
install.tar. When you have verified Portal is
installed and running correctly, install WebSphere Studio and the Remote Agent Controller. Inside
the Portal Toolkit, create a remote server instance for the Portal install on the same machine.
You can then debug portlet applications on this server. You can add additional portlets to
this server. This procedure is documented in the
Portal Toolkit documentation, which is included with the Toolkit.
However, during debug, you only see
the portlets being debugged. If you want to use the Web clipper, you need to start the portal manually.
Question: This question is regarding portal backup procedure for production environment portal server. In the event of hardware/software failure and our live server goes down, are there any well defined steps that we can take to revive the portal. What are various folders/files/database/xml etc we need to backup for a live portal? What is the sequence of steps for a) backing up b) reviving the portal? (submitted by KS)
Answer: My expertise is not in this area, but this is a good question. Because changes in the administration of portal are stored in the database, all of the database files need to be backed up. Of course, changes to the user data is usually reflected back into the backing LDAP directory, so these need to be backed up also. Finally, theme and skin changes usually cause changes in properties files and other files. These are in all of the markup directories.
There is not a good procedure for backing up the portal because state changes are made in several files. To save all of the portal state information, the best procedure is as follows:
- Backup the entire Portal install directory structure
- Backup Portal databases in DB2
- Backup the user directory store
With this said, have you considered running the portal in a cluster? You can use a cluster to keep the system up when one of the nodes of a cluster fails.
Question: I have recently been asked to provide a sort of road map for application developers in a large enterprise to help them better define criteria or a decision tree for when to develop a portlet, WAS web app, Web Service. Assume they are a bank with WAS installed and are proficient Java developers. What would this decision tree look like for them or what are the criteria? They assert that they could develop a WAS web app instead of a portlet or web service, so why do we need portal?
Further, I assert with them that WPS, or a portal, has included services that can be consistently used to shorten their development, security, presentation, etc. They want to know more specifically, what can these services do to make our development more productive and responsive to user needs. (submitted by John Ganovsky, IBM)
Answer: Everything you allude to is true. The portal will standardize a number of things as you suggest: security, presentation, application structure, etc. The decision to move to a portal is more binary in my view. That is, a portal is a lot like a windowed GUI. If you have committed to moving to a GUI, then it only seems natural that all applications running on the GUI be windowed applications. It is much the same with the portal. If the customer believes they want a windowed (shall we say "Portal'd") interface, then it is natural that the applications be portlets.
The customer will want to minimize links from portlet applications to full screen Web applications. The flow will not be there for the user from portlet applications to the full screen applications, unless they are well crafted by the visual experts on the team. These are just guidelines. You need to spend some time understanding if the customer wants a portal interface and will invest in the programming model; or, wants the programming model, and as a result is willing to invest in the Portal user interface.
Question: On the Windows platform, I want to be able to view/share WebSphere perspectives in Eclipse and vice versa. What version of each product supports this and how would it be implemented? (submitted by LH)
Answer: I believe this function is currently not possible to exchange perspectives between an Eclipse and a WebSphere Studio installation. The reasons are many, but the main reason is that a perspective opens up a view of a set of tools. In WebSphere Studio, most of these tools are WebSphere Studio tools, which are shipped only with WebSphere Studio, not with Eclipse.
With this said, I know as WebSphere Studio evolves, it will also pick up later versions of Eclipse that are more rich in function. I would make this common Eclipse tools requirement known to your IBM marketing representative.
Question: I am looking for a way to integrate WebSphere Portal Server and mail exchange server using single sign on. Could you help? (submitted by Vaibhav Verma)
Answer: I need to know which mail exchange you are using. Is this Microsoft Mail Exchange? What version? You can email me at firstname.lastname@example.org.
- WebSphere Portal: Portlet Concepts and Guidelines
- Portlet Development Guide: Second Edition
- Installing WebSphere Portal Express