NexJ Logo

Including a remote portlet in your application

When you are running your application on a NexJ server, you can include a portlet from another NexJ server in one of your application's workspaces.

Your application's NexJ server is considered the host server, while the remote portlet's NexJ server is considered the guest server.

To include a remote portlet in your application:

  1. To configure the host server to recognize the guest server, add the following code to the .environment file for your application:


       <Hosts>
          <Host name="guest" trusted="true" url="http://localhost:6080/camp"/>
       </Hosts>

    The url value above represents the location of the guest server.

  2. To configure the guest server to recognize the host server, add the following code to the .environment file for the remote portlet's server.

       <Hosts>
          <Host name="host" trusted="true" url="http://localhost:7080/nexj"/>
       </Hosts>

    The url value above represents the location of the host server.

  3. Configure the workspace.

    In the Navigator, Banner, and PortletRef elements, include the reference to the remote portlet that is hosted by the guest server, in the following format:
    portlet="host:/guest/<path_to_portlet>?$=<portlet_name>

    The path to the portlet includes the portlet name.

    Ensure that the Page element definition includes both the case and the name attributes. For example, <Page case="camp:Campaign" name="page">

    This sample workspace has been configured with remote portlets only. The order with which the portlets and tabs are displayed reflects the order in which they are included in the page or tab definition.

    <Workspace caption="idss.CampaignPortlet.caption" icon="icon:insert_chart">
       <Navigator name="refCampaignNavigator" portlet="host:/guest/ui/portlet/camp:CampaignNavigator?$=camp:CampaignNavigator"/>
       <Page case="camp:Campaign" name="page">
          <Banner name="campaignBanner_portlet" portlet="host:/guest/ui/portlet/camp:CampaignBanner?$=camp:CampaignBanner"/>
          <Tab caption="IDS_DETAILS" layout="cols:3 fluid:true" name="tabDetail">
             <PortletRef name="campaignDescription_portlet" portlet="host:/guest/ui/portlet/camp:CampaignDescription?$=camp:CampaignDescription"/>
             <PortletRef name="campaignBudget_portlet" portlet="host:/guest/ui/portlet/camp:CampaignBudget?$=camp:CampaignBudget"/>
             <PortletRef name="teamMembers_portlet" portlet="host:/guest/ui/portlet/camp:TeamMembers?$=camp:TeamMembers"/>
             <PortletRef name="activities_portlet" portlet="host:/guest/ui/portlet/camp:CampaignActivities?$=camp:CampaignActivities"/>
             <PortletRef name="opportunities_portlet" portlet="host:/guest/ui/portlet/camp:CampaignOpportunities?$=camp:CampaignOpportunities"/>
             <PortletRef name="notes_portlet" portlet="host:/guest/ui/portlet/camp:Notes?$=camp:Notes"/>
          </Tab>
          <Tab caption="idsc.Campaign.participants" layout="cols:3 fluid:true" name="tabParticipants">
             <PortletRef name="campaignParticipants_portlet" portlet="host:/guest/ui/portlet/camp:CampaignParticipants?$=camp:CampaignParticipants"/>
          </Tab>
       </Page>
    </Workspace>
  4. After configuring the workspace, upgrade or recreate the database. For more information, see Configuring a database environment.