NexJ Logo

Editing portlet details

You can view and edit the details of any portlet that is listed in the Portlets list.

To view and edit portlet properties:

  1. In your NexJ application, click the Options button and select Show Portal Admin.
    The Portal Tools menu opens.
  2. In the Portlets list, locate the portlet whose details you want to view or edit.
  3. Double-click the portlet name.
    The Edit Properties dialog opens.
  4. Make the changes you want to make, and click OK to save your changes.

The changes that you make are saved and take effect immediately. However, sometimes a workspace must be refreshed for the change to visible in the application.

Using context variables in portlet URLs

Context variables can be added to portlet URLs.

You may want the web address of a portlet to contain context information that is passed to the workspace when it opens. Using context variables in URLs can automate and streamline tasks. For example, if a portlet displays a map from an external website, you can include a contact's address as part of the URL query. This allows the map to immediately focus on the contact's location without manual entry. Context variables can be included in URLs using context parameters.

Use the following syntax to place context variables in URLs: ${ContextVar}

The following is an example of a portlet URL with context parameters:

  • <://example.portlet.com/portletname.html>?<PortletVar1>=${<ContextVar1>}&<PortletVar2>=${<ContextVar2>}&<PortletVar3>=${<ContextVar3>}

where:

  • <https://example.portlet.com/portletname.html> is the full URL to the portlet. This is the same URL that is entered in the Enterprise Component Registry.
  • <PortletVar1>, <PortletVar2>, and <PortletVar3> are the variables that the portlet requires values for.
  • <ContextVar1>, <ContextVar2>, and <ContextVar3> are the context variables whose values you want to include in the portlet URL.


Info

Context variables in a portlet URL must be defined in the portlet's context attribute using NexJ Studio or the NexJ Admin Console to function properly.

You can use as many context variables as you want. You can use multiple context variables to create longer values. For example:

  • https://example.portlet.com/portletname.html?PortletVar1=${<ContextVar1>}+${<ContextVar2>}

When the URL is resolved, the ${<ContextVar>} strings are replaced with the value of the context variable. For example, if you have a workspace definition that includes a portlet with the following URL attribute:

  • /TestPlaceHolder.html?ContactId=${EntityId}

If the EntityId context variable has been set to 1234, when the workspace loads the portlet will resolve the parameter within the query string resulting in the following URL being accessed:

  • /TestPlaceHolder.html?ContactId=1234

The URL is recalculated every time the workspace loads the portlet.

If none of the context variables used in the URL are listed in the portlet's context attribute, the system will automatically append the context variables and query parameters to the portlet URL on initial load. Otherwise, only the context variables listed in the portlet's context attribute will be present; including variables in the URL that are not subscribed to will result in an error.

Context values passed this way are intended only for use during the initial loading of a portlet. If a portlet should listen to the context bus for changes in variables, you should design it to make use of the portal APIs.

Configuring context variables in portlet URLs

Insert context variables in a portlet URL using portal administration tools.

Info

Only users with administrative privileges can access the Portal Tools menu.


To modify a portlet URL:

  1. In your NexJ application, click the Options button and select Show Portal Admin.
    The Portal Tools menu opens.
  2. From the Portlets list, click Add or double-click an existing portlet.
    The Add Portlet or Edit Portlet Properties dialog opens.
  3. List the context variables this portlet will send and receive in the Context field. Use a comma delimited list to include more than one context variable.
  4. Insert your portlet's web address with the appropriate context variables in the URL field.

    Info

    Add context variables to your portlet's URL using the following format: ${ContextVar}.

  5. [Optional] If your portlet is retrieving information from a third-party source, ensure Use HTTP Get is enabled.
  6. Click OK to save your changes.
    The Add Portlet or Edit Portlet Properties Dialog closes.

Your changes to the portlet URL have been saved.