Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Using and switching between JSR-168 portlet modes

Portlet Modes Available in uPortal

The modes currently available to uPortal portlets are those enumerated by the JSR-168 specification. More explicitly, these modes are:

  • VIEW
  • EDIT
  • CONFIG (custom portlet mode)
  • HELP

Using Edit Mode

Edit mode is often used to display a configuration screen to users of your portlet. If you pursue this strategy, you may also wish to use the PortletPreferences API to record the configuration options your users select. To accomplish this, make the configuration form POST to an action URL and modify the preferences during the ActionRequest.

If you wish to render an 'edit' link or button to help your users navigate to the edit mode of your portlet, read the section below.

Using Config Mode

Config mode is a custom uPortal mode used to display an administrative configuration screen appropriate for configuring all instances of a particular portlet definition. For example, the Google Maps portlet distributed with uPortal uses Config mode to allow an administrator to set a Google API key.

Config mode is only accessible via the portlet administration tool; you will never need to write code to explicitly enter config mode. Once configuration is complete, you should set the portlet mode back to View.

Switching between portlet modes

Changing portlet mode through URLs

The most common method of switching portlet modes is through a URL. For example, you might create an "edit" URL that when clicked, sends the user to the portlet's edit mode. Portlet mode-switching links may be created through the use of the portlet JSP tag library:

<portlet:renderURL mode="edit"/>

It is also possible to create a URL which will switch the mode of a portlet through direct use of the Java API:

PortletURL myPortletURL = response.createRenderURL();
myPortletURL.setPortletMode(PortletModeEDIT);

Window states may also be set via either the JSP tag or Java API.

Changing portlet mode programmatically

actionResponse.setPortletMode(PortletMode.EDIT);
  • No labels