Creating Popup Windows
It is often desirable to use popup windows to implement
application functionality. These can be problematic in a portal environment.
To successfully implement popup windows in a portal environment, care must
be taken to understand the context in which the window is executing. Normally,
a portlet is invoked by the portlet container. When implementing popup
windows the portlet is actually called directly through the servlet container.
(This is very similar to how Portlet Factory models are called in test
or standalone mode.)
Attached is a sample model demonstrating how to create
a popup window from a portlet. The main technique used here is the use
of the getBackchannelActionURL method of the WebAppAccess object. This
method generates a URL that accesses an action in the model via the application's
servlet context. It is important to note that any actions called in the
model through this means will not have access to all of the portal context
that is usually present in a portlet application.
The sample also demonstrates some techniques for passing
In the sample, the portlet window's namespace is retrieved and used to
uniquely identify the form in the portal context. (This allows multiple
instances of this portlet to co-exist on the same page.) The portlet window's
then uses the portlet window's namespace to pass data back to its parent
window and populate the form on the page.
Here is a screenshot of the attached sample model:
Notes on running the sample and prerequisites
Import the attached zip file into your project using the
Import WebSphere Portlet Factory Archive command.
This sample should run in both a standalone context as
well as in a portlet context.
The sample model can be downloaded here: PopupSample.zip