JBoss Community Archive (Read Only)

Portlet Bridge 3.1

Navigation

Switching Portlet Modes

A PortletMode represents a distinct render path within an application. There are three standard modes: view, edit, and help. The Bridge's ExternalContext.encodeActionURL() recognizes the query string parameter javax.portlet.faces.PortletMode and uses this parameter's value to set the portlet mode on the underlying portlet actionURL or response, but once processed it then removes this parameter from the query string.

The following navigation rule causes one to render the \edit.xhtml viewId in the portlet edit mode:

<navigation-rule>
  <from-view-id>/register.xhtml</from-view-id>
  <navigation-case>
    <from-outcome>edit</from-outcome>
    <to-view-id>/edit.xhtml?javax.portlet.faces.PortletMode=edit</to-view-id>
  </navigation-case>
</navigation-rule>

Portlet Mode's last viewId

By default a mode change will start in the mode's default view without any (prior) existing state. One common portlet pattern when returning to the mode one left after entering another mode (e.g.. view -> edit -> view) is to return to the last view (and state) of this original mode. The Bridge will explicitly encode the necessary information so that when returning to a prior mode it can target the appropriate view and restore the appropriate state. The session attributes maintained by the Bridge are intended to be used by developers to navigate back from a mode to the last location and state of a prior mode, as such a developer needs to describe a dynamic navigation: "from view X return to the last view of mode y". This is most easily expressed via an EL expression, for example:

<navigation-rule>
  <from-view-id>/edit.xhtml*</from-view-id>
  <navigation-case>
    <from-outcome>view</from-outcome>
    <to-view-id>#{sessionScope['javax.portlet.faces.viewIdHistory.view']}</to-view-id>
  </navigation-case>
</navigation-rule>

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:27:01 UTC, last content change 2012-07-31 18:52:13 UTC.