5.2.2.3. Adding portlet to page by configuration

Through UI, you need to register a portlet to portal-managed applications prior to adding it to a page. By configuration, it is not required.

Assume that you already configured a site and some pages by site extension. To add your hello-portlet to a page, you just need to modify pages.xml to add the following configuration:


<portlet-application>
        <portlet>
            <application-ref>hello-portlet</application-ref>
            <portlet-ref>Hello</portlet-ref>
        </portlet>
        <title>Hello</title>
        <access-permissions>*:/platform/users</access-permissions>
        <show-info-bar>false</show-info-bar>
        <show-application-state>false</show-application-state>
        <show-application-mode>false</show-application-mode>
    </portlet-application>

So the whole file looks like this:


<page-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
      xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
        <page>
            <name>homepage</name>
            <title>Home Page</title>
            <access-permissions>*:/platform/users</access-permissions>
            <edit-permission>*:/platform/administrators</edit-permission>
            <portlet-application>
                <portlet>
                    <application-ref>hello-portlet</application-ref>
                    <portlet-ref>Hello</portlet-ref>
                </portlet>
                <title>Hello</title>
                <access-permissions>*:/platform/users</access-permissions>
                <show-info-bar>false</show-info-bar>
                <show-application-state>false</show-application-state>
                <show-application-mode>false</show-application-mode>
            </portlet-application>
        </page>
    </page-set>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus