Creating device-specific portlet content using conditional XDIME markup

You can create device-specific portlet content using conditional XDIME markup within your portlet JSP.

As an alternative to using the Multi-Channel Server APIs described previously, you can use conditional XDIME markup within your portlet JSP to control what markup will be generated for a set of devices that have common characteristics.

The conditional markup contains XML elements that essentially provide select statement capabilities. The following example illustrates how to generate conditional markup that checks the device's manufacturer attribute and displays a different logo for the Nokia vs. Samsung manufacturers.
<select expr="device:getPolicyValue('mfg')">
    <when expr="'Nokia'">
        <img src="/mfgimages/nokia.mimg"/>
    </when>
    <when expr="'Samsung'">
        <img src="/mfgimages/samsung.mimg"/>
    </when>
    <otherwise>
        <p>Unknown Manufacturer</p>
    </otherwise>
</select>
See the Conditions topic of the XDIME element reference section of the Multi-Channel Server 6.3.1 information center plug-in for further information on conditional XDIME markup. The device:getPolicyValue() method takes a device policy attribute name as input and returns a string. To get the list of device policy names, use the Mobile Portal Toolkit Device Policy Browser. The policy names that can be used with the getPolicyValue() method are in the shortname column displayed by the device policy browser.



Terms of use
(C) Copyright IBM Corporation 2012. All Rights Reserved.