Jul 23, 2013

Embed portlet in theme

  • 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 theme.
  • Embedding portlet in theme
    • Open the velocity template file in which you want to embed the portlet.
    • Add below code in velocity template.
Code snippet

<div id="embedded-test-div">
$theme.runtime("headercart_WAR_headercartportlet","queryString", $velocityPortletPreferences.toString())
</div>

  • The Red marked line is for to embed a portlet in to theme
    • name="headercart_WAR_headercartportlet" the name of your portlet to be embedded with.
    • queryString="" give queryString if any other wise blank as it is optional.
    • You can set preferences using velocityPortletPreferences string or give blank this is also optional.
  • You are done now deploy the theme and you will get the porltet embedded with theme.
  • For more information do visit the link

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.