Jul 4, 2013

Example of Embedding a portlet in to a web content portlet


  • Create a portlet with any name you want, EX. "portlet-embedded".
  • Write your code in portlet (view.jsp) to be displayed.
  • After adding your code to the portlet deploy the portlet so it is available for to use in web content.
  • Adding web content on page
    • Go to dock bar and select Add button and click Web Content Display so it's add Web Content Display portlet on to your page.
    • After adding web content to page now add the content to web content display by clicking Add Web Content button of Web Content Display portlet. 
Code snippet

   <div id="test-div">
<div id="testdata">
Lorem Ipsum is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and 
scrambled it to make a type specimen book. 
</div>
<div id="embedded-test-div">
            <runtime-portlet 
name="portletembedded_WAR_portletembeddedportlet" 
instance="" queryString=""/>
</div>
</div>


  • The Red marked line is for to embed a portlet in to web content 
    • name="portletembedded_WAR_portletembeddedportlet" the name of your portlet to be embedded with.
    • instance="" give instance name other wise blank.
    • queryString="" give queryString if any other wise blank.
  • After adding this save the web content with proper name.
  • So it display the web content with your data plus the portlet with their data as shown below. 





1 comment:

Note: Only a member of this blog may post a comment.