Programming guidelines

Refer to the programming guidelines to ensure portlets adhere to the required standards.


Guidelines for markup, JavaScript, and URLs

Follow these guidelines:


Guidelines for the usage of portlet URLs

Follow the guidelines given by this table:

URL type HTML elements HTTP verbs Comments
Action URL (GET)”> (<a>) POST, (GET) This must not be used for Ajax requests or XHR.
Render URL <a> <form method=”GET”> GET This must not be used for Ajax requests or XHR.
Resource URL <a> <form> XHR GET, HEAD, PUT, POST, DELETE   —


Guidelines for Ajax portlet development

Depending on use case, follow the guidelines given here:
Portlet loads data.


Portlet loads markup fragment or data from the server to change its view.


Portlet changes its view without communicating with the server.


Portlet changes its view dynamically and sets a public render parameter.


Portlet changes its view and spawns an event.


Portlet modifies portlet preferences


Portlet modifies the session state


Portlets that you can use in client-side mode

In general, all portlets that are programmed to comply with one of the standard APIs JSR168 or JSR286 can be rendered in client side mode. Portlets that are programmed to comply with the older IBMPortlet API cannot be used in client side mode. However, standard portlets are subject to a few exceptions, where they cannot be rendered in client side mode. This includes cases where the following APIs are used:

Moreover, request attributes are not transmitted between portlet lifecycle phases.


Explicitly disabling portlets for client-side mode

As the portal cannot automatically detect the instances where portlets use APIs that are not compliant with client-side mode, you can use the portlet preference com.ibm.portal.preventRenderType to disable client-side rendering for standard portlets if you set one of the values to iwidget. You can set this preference on all customization levels. In the portlet.xml you declare this setting as follows:

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app  [...]>
    <portlet>
         [...]
        <portlet-name>NonClientSidePortlet</portlet-name>
        <portlet-class>my.server.side.Portlet</portlet-class>
         [...]
        <portlet-preferences>
       		<preference>
       			<name>com.ibm.portal.preventRenderType</name>
       			<value>iwidget</value>
                         [...]
       			<read-only>true</read-only>
       		</preference>
       </portlet-preferences>
    </portlet>
     [...]
</portlet-app>


Parent

Programming model guidelines for client-side mode

 


+

Search Tips   |   Advanced Search