Custom Portlet XML File Configuration
From GroundWork Developer Kit
Contents |
[edit] Required Changes to XML Files
You must edit the following XML files before deploying your custom portlet:
- portlet-instances.xml
- portlet.xml
- project.xml
[edit] portlet-instances.xml
Navigate to the portlet-instances.xml file located in:
/usr/local/groundwork/gdk/monitor-portal/applications/<sample-xxx>/src/main/webapp/WEB-INF/portlet-instances.xml
- Where <sample-xxx> is the directory associated with the language you are using.
Example: If coding in PHP, navigate to the portlet-instances.xml file located in the sample-php directory:
/usr/local/groundwork/gdk/monitor-portal/applications/sample-php/src/main/webapp/WEB-INF/portlet-instances.xml
In the <deployment> section, edit the <instance-id> and <portlet-ref> content:
<deployment>
<instance>
<instance-id>SamplePhpInstance</instance-id>
<portlet-ref>SamplePhpPortlet</portlet-ref>
</instance>
</deployment>
where:
- SamplePhpInstance is the name of your application
- SamplePhpPortlet is the name of your portlet
[edit] portlet.xml changes
Navigate to the portlet.xml file located in:
/usr/local/groundwork/gdk/monitor-portal/applications/<sample-xxx>/src/main/webapp/WEB-INF/portlet.xml
- Where <sample-xxx> is the directory associated with the language you are using.
Example: If coding in PHP, navigate to the portlet.xml file located in:
/usr/local/groundwork/gdk/monitor-portal/applications/sample-php/src/main/webapp/WEB-INF/portlet.xml
In the <portlet> section, edit the <portlet-name>, <portlet-class>, and <portlet-info> and <init-param> sections.
<portlet>
<portlet-name>SamplePhpPortlet
</portlet-name>
<portlet-class>org.groundwork.portlet.php.GWSamplePhpPortlet
</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>Sample Php Portlet</title>
</portlet-info>
<init-param>
<name>SCRIPT</name>
<value>PHP</value>
</init-param>
<init-param>
<name>URL</name>
<value>php/env.php</value>
</init-param>
</portlet>
Where:
- SamplePhpPortlet = <<your portlet name>>
- Sample Php Portlet = <<your portlet name>>
- php/env.php = <<your PHP code name>>
The figure below displays the structure of the WEB-INF Directory containing portlet-instances.xml and portlet.xml
[edit] project.xml changes
Navigate to the project.xml file located in:
/usr/local/groundwork/gdk/monitor-portal/applications/<sample-xxx>/project.xml
- Where <sample-xxx> is the directory associated with the language you are using.
Example: If coding in PHP, navigate to the project.xml file located in:
/usr/local/groundwork/gdk/monitor-portal/applications/sample-php/project.xml
Edit the <artifactId>:
<!-- a unique name for this project -->
<artifactId>portal-sample-php</artifactId>
Where:
- portal-sample-php = your portal name
[edit] More Information
Refer to: