Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • WebSphere Portal Family wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category IBM Redbooks: Building a Sample Website Using IBM Web Content Manager 7.0 IBM Redbooks: Building and Implementing a Social Portal IBM Redbooks: Developing Exceptional Multi-Channel Web Experiences V7: IBM Web Content Manager Product Documentation V7: IBM WebSphere Portal Enable for z/OS Product Documentation V7: IBM WebSphere Portal Express Product Documentation V7: WebSphere Portal Product Documentation V8: IBM Web Content Manager Product Documentation V8: IBM WebSphere Portal Express Product Documentation V8: IBM WebSphere Portal Product Documentation (includes z/OS) Custom Search Scope...
Search
Community Articles > IBM Accelerators for WebSphere Portal > Building device-attribute-based mobile sites with IBM Mobile Portal Accelerator
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

IBM contributorLeslie Gallo
Contribution Summary:
  • Articles authored: 30
  • Articles edited: 14
  • Comments Posted: 0

Recent articles by this author

Collecting performance measurements of your IBM WebSphere - Java Virtual Machine

This article discusses an example of creating a collection of IBM WebSphere Portal performance measurements, using the Administrator Thin Client to running a jython script for collecting the desired data.

Integrating IBM WebSphere Portal 7 with Microsoft SharePoint 2010

This article explains how to integrate the portal frameworks between IBM WebSphere Portal, which is based on the J2EE programming model, and Microsoft SharePoint, which is based on the .NET programming model.

IBM WebSphere Portal 7 customization scenario: Part 1, Customizing a menu portlet

During an IBM WebSphere Portal implementation, customization is typically required in a few areas. This article explains how to build a customized WebSphere Portal menu in a JSR portlet, using WebSphere Portal 7 APISPIs.

Increasing the Search Engine Optimization ranking for IBM Web Content Manager Web sites

Learn how how you can remove both the traditional 301 (0 302) redirect from a Web site root to an IBM Web Content Manager URL and the common path part from the URL, such as wcpwcmconnectlibraryName.

Performance management tools for IBM WebSphere Portal

This document details the tooling that was used during a recent performancerelated customer engagement. It describes the tools and how they were used to evaluate IBM WebSphere Portal 7 performance problem determination issues.

Community articleBuilding device-attribute-based mobile sites with IBM Mobile Portal Accelerator

Added by IBM contributor Leslie Gallo | Edited by IBM contributor Leslie Gallo on October 31, 2011 | Version 29
  • Edit
  • More Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
Learn how to build a device-attribute-based mobile site, using IBM Mobile Portal Accelerator, that is based on one or more attributes of the requesting device already present in the MPA device repository.
Tags:
ShowTable of Contents
HideTable of Contents
  • 1 Introduction
    • 1.1 Prerequisites
  • 2 Setting up the development environment
    • 2.1 Create the XDIME aggregator project
    • 2.2 Create an MCS Policies project
  • 3 Customize MCSPolicies
  • 4 Customizing the XdimeAggregator JSPs
  • 5 Testing
  • 6 Conclusion
  • 7 Resources
  • 8 About the author

Introduction


IBM® Mobile Portal Accelerator (MPA) is a free-of-charge extension to IBM WebSphere® Portal that provides an easy, cost-effective way to deliver content and applications to virtually all mobile devices. Its intelligent Multi-channel Server adapts the content for each mobile device based on the specific device characteristics and capabilities, as defined in the software's device repository.

Figure 1 illustrates the basic high-level architecture for MPA.

Figure 1. MPA architecture


MPA provides device-specific markup capability and, to display content on a range of devices, you must specify a layout policy with variants that are suited to different device characteristics, after which you associate the variants with one or more devices.

This mapping to a set of mobile devices is done either by:
  • Choosing individual model numbers for a particular layout, or
  • Assigning the layout to a family of devices, for example, Tablet or SmartBook, or by the manufacturer (Apple, BlackBerry, etc.)
These approaches are not always sufficient, however, especially for scenarios in which the implementation does not require a device-based, layout-mapping approach. These scenarios can be time consuming and may require significant effort to map layouts to devices---especially if there is quite a wide range of mobile devices to tackle.

This article describes a solution to tackle such scenarios by explaining how to build a device-attribute-based mobile site that is based on one or more attributes of the requesting device that are already present in the MPA device repository, thereby providing a programmatic approach to device grouping.

An example of such a scenario could be the width of the requesting mobile device. We'll discuss the details of how a different UI for the mobile site can be shown, depending on the width of the requesting device. A similar approach can be applied to other device attributes, such as page size / resolution, etc., that are present in Volantis' Multi-Channel Server (MCS) database.

Prerequisites


You'll need the following software to complete the steps in this article:
  • IBM Rational® Application Developer 8
  • IBM WebSphere Portal Server 7 with MPA 7
  • IBM Mobile Portal Toolkit 7 (as a part of IBM MPA license)
  • Device Emulators
To get the most from this article, you should have an understanding of WebSphere Portal Server, Rational Software Development Platform, Mobile Portal Accelerator, JavaTMServer Pages (JSPs), xHTML Device Independent Markup Extensions (Xdime), portal aggregator, and MCS policy development.

Setting up the development environment


Let's begin by setting up the development environment.

Create the XDIME aggregator project


1. In Rational Application Developer (RAD), create a General project as shown figure 2; click Next.

Figure 2. Create a General project



2. Specify MyXdimeAggregator as the Project name and click Finish (see figure 3).

Figure 3. New Project window



3. Copy the contents of MPA Theme application from wp_profile_rootinstalledApps/node_name/MPATheme.ear/MPATheme.war into the project created above (see figure 4). For more information about making changes to MPA theme, refer to the IBM Mobile Portal Accelerator 7.0 information center.

Figure 4. MyXdimeAggregator

Create an MCS Policies project


To do this:
  1. In RAD, create a General project as we did above, specify MyMCSPolicies as the Project name, and click Finish.
  2. Export the aggregator policies from MCS database and copy the policy files to the above-created project (see figure 5). For more information about exporting and importing policies, refer to MPA InfoCenter topic, “Importing and exporting repositories.”
NOTE: If, instead of an actual database, an XML-based repository is being used, then the policy files can be copied from there.

Figure 5. MyMCSPolicies

Customize MCSPolicies


To do this:
  1. Switch to the MCS Navigator perspective in RAD and associate an .mdpr mcs repository file to the project, which comes with the product.
  2. In MyMCSPolicies project, open the wp_header.mlyt file and choose the Design view; the Layout design contains two panes, G and H, as shown in figure 6.
Figure 6. Layout Design window



3. Add another row after the row containing pane G by right-clicking pane G and selecting Grid --- Insert Row (see figure 7).

Figure 7. Add another row



4. In the Insert row window (see figure 8), enter a “1” for the Number input, to insert just one row, and enter “After” as the position to place it after the row containing G Pane; click OK.

Figure 8. Insert row window


This adds another row to the layout as shown in figure 9.

Figure 9. Another row added



5. Right-click on the newly inserted row and add two columns to it, using Add –- Grid --- 2 Columns, as shown in figure 10.

Figure 10. Add two columns



6. Right -click on Column 1, select Add --- Pane --- Pane (see figure 11), and name it “HeaderImage” in the Format Attributes section (see figure 12).

Figure 11. Add Pane



Figure 12. Formal Attributes section



7. In the same way, add a pane to Column 2, and name it “HeaderSearch”. The Layout Design will now look similar to that shown in figure 13.

Figure 13. HeaderSearch pane added to Column 2


8. Replace the original wp_header.mlyt file with the modified version and, if you are using a database for MCS repository, import the policies into the MCS database. If you're using an XML-repository instead, then replace the file directly. Note that a restart of WebSphere Portal server may be required.

Customizing the XdimeAggregator JSPs


To do this:

1. Enable the JSP reloading so that the changes to the XDIME aggregator JSP’s are reflected immediately and a server restart is not required. Refer to the WebSphere Portal InfoCenter topic, “JavaServer Pages (JSP) runtime reloading settings,” for more information.

We conditionally render either pane “G” or panes “HeaderImage” and “HeaderSearch,” depending on the width of the requesting device.

We use the MCS expressions to determine the value of the device width attribute from the MCS repository, and then use it to conditionally render a pane, depending on the value of the width attribute of the device.
2. Modify the Header.jsp file under the themes/xdime/mpatheme/common folder and find the following section:
<img pane="G" src="<mwp:vpMapper name='/wp/logo.mimg'/>" alt="WebSphere Portal" /> 
replacing it with the following:
<img pane="G" expr="number(device:getPolicyValue('fullpixelsx'))&lt;=250" src="<mwp:vpMapper name='/wp/logo.mimg'/>" alt="WebSphere Portal" />
After this change, the pane “G” will be rendered only if the requesting device width is less than or equal to 250 pixels.
3. Insert the following at the end of the above image tag:
<img pane="HeaderImage" expr="number(device:getPolicyValue('fullpixelsx'))&gt;250" src="<mwp:vpMapper name='/wp/logo.mimg'/>" alt="WebSphere Portal" />

<pane name="HeaderSearch" expr="number(device:getPolicyValue('fullpixelsx'))&gt;250">
<p><a href="#">SendFeedback</a> <a href="#">ContactUs</a></p>
</pane>
After this change, the image in the “HeaderImage” pane and the links in the “HeaderSearch” pane will be displayed only if the requesting device width is greater than 250 pixels.

The contents of the Header.jsp will now look like that shown in listing 1.
Listing 1. Contents of Header.jsp
<%
	if(Debug.DEBUG_AGGR && logger.isLogging(Logger.TRACE_HIGH)){
		logger.entry(Logger.TRACE_HIGH, "/common/Header.jsp");
	}	
%>
<region name="header">
  <canvas layoutName="<mwp:vpMapper name="/wp_header.mlyt"  nlsSensitive="<%=getLocaleIsBidi(request)%>" />" type="portlet">
    <pane name="H.0" class="wpsPlaceBar"><%=navHelper.getPageTitle()%> 
</pane>
<img pane="G" expr="number(device:getPolicyValue('fullpixelsx'))&lt;=250" src="<mwp:vpMapper name='/wp/logo.mimg'/>" alt="WebSphere Portal" />
<img pane="HeaderImage" expr="number(device:getPolicyValue('fullpixelsx'))&gt;250" src="<mwp:vpMapper name='/wp/logo.mimg'/>" alt="WebSphere Portal" />
<pane name="HeaderSearch" expr="number(device:getPolicyValue('fullpixelsx'))&gt;250">
<p><a href="#">SendFeedback</a> <a href="#">ContactUs</a></p>
</pane>	
  </canvas>
</region> <!-- "header" -->

<%
	if(Debug.DEBUG_AGGR && logger.isLogging(Logger.TRACE_HIGH)){
			logger.exit(Logger.TRACE_HIGH, "/common/Header.jsp");
  }
%>
4. Now replace the Header.jsp file under
wp_profile_root/installedApps/node_name/MPATheme.ear/MPATheme.war/themes/ xdime/mpatheme/common
with the file modified above.
5. Finally, touch the Default.jsp’s under
wp_profile_root/installedApps/node_name/MPATheme.ear/MPATheme.war/themes /xdime/mpatheme/treeview
and
wp_profile_root/installedApps/node_name/MPATheme.ear/MPATheme.war/themes /xdime/mpatheme
for the changes to take effect.

Testing


To test the mobile site using device emulators, we select two such emulators, one of which has a device width attribute less than or equal to 250 pixels, and the other has a width attribute greater than 250 pixels.

The results from two such mobile emulators are shown in figures 14 and 15, showcasing different site variants depending on the width of the device. For the device that is less than 250 pixels wide, we show just the header image (see figure 14), whereas for the device that that is more than 250 pixels wide, we show header image together with two header links, Feedback and ContactUs (see figure 15).

Figure 14. Site for a less-than-250-pixels-wide device



Figure 15. Site for a greater-than-250-pixels-wide device


Conclusion


In this article you learned how a device-attribute-based mobile site can be built that is based on one or multiple attributes of the requesting device already present in the MPA device repository, thereby providing a programmatic approach to device grouping. Similar approaches can be applied for other available attributes in the MCS database.

Resources


IBM Mobile Portal Accelerator 7.0 Information Center:
http://publib.boulder.ibm.com/infocenter/mpadoc/v7r0m0/

IBM Mobile Portal Accelerator 6.1.x Information Center:
http://publib.boulder.ibm.com/infocenter/mpadoc/v6r1m0/index.jsp

IBM WebSphere Portal 7.0 product documentation:
http://www.ibm.com/developerworks/websphere/zones/portal/proddoc.html#v70proddocwiki

IBM Mobile Portal Accelerator product page:
http://www-01.ibm.com/software/lotus/portal/value/mobileaccelerator/

IBM Accelerators for WebSphere Portal product page:
http://www-01.ibm.com/software/lotus/portal/value/

About the author


Animesh Sharma is a WebSphere Portal Specialist with IBM India Software Labs, currently working for the Lab Services division. He specializes in WebSphere Portal, IBM Mobile Portal Accelerator, IBM Web Experience Factory, and IBM Web Content Manager, and participates in various customer-facing engagements. You can reach Animesh at animshar@in.ibm.com.



  • Edit
  • More Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (29)
collapsed Versions (29)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (29)Oct 31, 2011 5:46:51 PMLeslie Gallo  IBM contributor
27Oct 31, 2011 5:03:21 PMJennifer Heins  IBM contributor
26Oct 31, 2011 5:00:34 PMJennifer Heins  IBM contributor
25Oct 31, 2011 4:59:59 PMJennifer Heins  IBM contributor
24Oct 31, 2011 4:59:21 PMJennifer Heins  IBM contributor
23Oct 31, 2011 4:58:43 PMJennifer Heins  IBM contributor
22Oct 31, 2011 4:57:45 PMJennifer Heins  IBM contributor
21Oct 31, 2011 4:57:02 PMJennifer Heins  IBM contributor
20Oct 31, 2011 4:56:25 PMJennifer Heins  IBM contributor
19Oct 31, 2011 4:55:34 PMJennifer Heins  IBM contributor
18Oct 31, 2011 4:54:46 PMJennifer Heins  IBM contributor
17Oct 31, 2011 4:54:09 PMJennifer Heins  IBM contributor
16Oct 31, 2011 4:53:14 PMJennifer Heins  IBM contributor
15Oct 31, 2011 4:52:57 PMJennifer Heins  IBM contributor
14Oct 31, 2011 4:52:16 PMJennifer Heins  IBM contributor
13Oct 31, 2011 4:51:42 PMJennifer Heins  IBM contributor
12Oct 31, 2011 4:46:51 PMJennifer Heins  IBM contributor
11Oct 31, 2011 4:45:41 PMJennifer Heins  IBM contributor
10Oct 31, 2011 4:44:11 PMJennifer Heins  IBM contributor
9Oct 28, 2011 11:06:13 AMLeslie Gallo  IBM contributor
8Oct 28, 2011 10:47:13 AMLeslie Gallo  IBM contributor
7Oct 28, 2011 10:36:42 AMLeslie Gallo  IBM contributor
6Oct 27, 2011 3:37:41 PMLeslie Gallo  IBM contributor
6Oct 27, 2011 3:53:39 PMLeslie Gallo  IBM contributor
5Oct 27, 2011 1:57:21 PMLeslie Gallo  IBM contributor
3Oct 27, 2011 1:44:02 PMLeslie Gallo  IBM contributor
2Oct 27, 2011 1:22:05 PMLeslie Gallo  IBM contributor
1Oct 27, 2011 1:18:01 PMLeslie Gallo  IBM contributor
1Oct 27, 2011 12:54:53 PMLeslie Gallo  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use