Using iWidgets in portlet

For easy handling of iWidgets WebSphere Portal provides a dedicated IWidget Wrapper portlet(Unique name for the portlet is wp.p.IWidgetWrapper). As name suggests this portlet wraps a iWidget into a portlet.

I wanted to try how the IWidgets Wrapper portlet works so these are the steps that i followed

  • Create a iWidget application. In my case i used RAD 8.0 to create simple Hello iWidget portlet
  • , if you want you can directly download the sample application from here
  • Install the HelloWidget.war file as J2EE application using WAS Admin Console, While installing make sure that you select WebSPhere Portal as target server and use /HelloIWidget as the context root

  • Start the HelloWidget.war file after installing it and make sure that you access the the http://localhost:10039/HelloIWidget//HelloWidget.xml url


  • The last step would be to register this iWidget with the IWidgetWrapperPortlet, you will have to execute register-iwidget-definition ConfigEngine task for that

    /ConfigEngine.sh register-iwidget-definition -DIWidgetDefinition=/HelloIWidget/HelloWidget.xml

    Execute this task and wait for it to complete successfully. This task downloads the HelloWidget.xml and parses it to find some values and then makes use of those values to create a clone of IWidgetWrapperPortlet, you can see this task executing few xmlaccess scripts

  • After the portlet is created you should be able to add it to any page using HelloIWidget as portlet name


  • If you take full export of your portal server and search for /HelloIWidget/HelloWidget.xml you should find following portlet definition

    <portlet action="update" active="true" defaultlocale="en" domain="rel"
    name="IWidgetWrapper.$cloned.Z3_8000CB1A008RE0IQCHVQBR20G0"
    objectid="Z3_8000CB1A008RE0IQCHVQBR20G0" provided="false" servletref="ZV_CGAH47L0085810IAHU76SD2OK1">
    <localedata locale="en">
    <title>HelloIWidget</title>
    </localedata>
    <preferences name="com.ibm.portal.iw:content:edit:value" update="set">
    <value><![CDATA[<div>Hello From WebSpherenotes.com - Edit Mode</div>]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:content:view:value" update="set">
    <value><![CDATA[<div>Hello From WebSpherenotes.com</div>]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:itemSet:idescriptor:iw:item:mode:value" update="set">
    <value><![CDATA[en]]></value>
    <value><![CDATA[view]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:itemSet:idescriptor:private" update="set">
    <value><![CDATA[true]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:allowInstanceContent" update="set">
    <value><![CDATA[false]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:base" update="set">
    <value><![CDATA[res:/HelloIWidget/HelloWidget.xml]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:id" update="set">
    <value><![CDATA[HelloIWidget]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:lang" update="set">
    <value><![CDATA[en]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:sandbox" update="set">
    <value><![CDATA[false]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:supportedModes" update="set">
    <value><![CDATA[view edit_defaults]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iw:iwidget:supportedWindowStates" update="set">
    <value><![CDATA[normal]]></value>
    </preferences>
    <preferences name="com.ibm.portal.iwidget.definition.expiration" update="set">
    <value><![CDATA[1285168645750]]></value>
    </preferences>
    <access-control externalized="false" owner="uid=wasadmin,o=defaultwimfilebasedrealm" private="false"/>
    </portlet>


1 comment:

Michel Jonker said...

Hi,

Thanks for the sample.
What if the portlet keeps displaying: "loading"

Are there theme/skin dependencies ?