+

Search Tips   |   Advanced Search

Programming guidelines


Refer to the programming guidelines to ensure the 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 the use case, follow the guidelines given here:


Portlets that we 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 IBM Portlet 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 APIthat are not compliant with client-side mode, we 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. We 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