Redirecting to different view JSP based on device type i.e. mobile/tablet/desktop at portal serverside

IBM websphere supports client profile information in portlets which is defined in JSR188 (

You can check if client request is coming from mobile/tablet or from desktop and redirect to different view accordingly with following sample code

String VIEW_JSP = "desktopView";
javax.ccpp.Profile profile = (javax.ccpp.Profile) portletRequest.getAttribute("javax.portlet.ccpp");
javax.ccpp.Attribute attr = profile.getAttribute("DeviceClass");

if(attr!=null && attr.toString().equals("tablet")){
VIEW_JSP = "tabletView";
}else if(attr!=null && attr.toString().equals("smartphone")){
VIEW_JSP = "mobileView";


  1. DeviceClass=smartphone/tablet
  2. Vendor=Apple/Samsung ..etc

No comments:

Post a Comment