Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-24928

Web Content Display Portlet embedded in Theme and Layout randomly displaying different content than specified by parameters or not displaying content at all.



      We have embedded several instances of web content display portlet in the theme and the layout of our site. Randomly, the web content display portlet shows a different content than the defined in the code. This happens on a regular basis (near 50% of the time), is not restricted to a particular page (happens on different pages as long as they use a layout with embedded web content), does not depend on the server's load (happens when viewing only one page or with several concurrent requests, under controlled conditions) and does not show any error or warning message at jboss's server log.
      The code used for embedding the web content display portlet in the layout is as follows (we have several pieces of code like this in the same layout, in order to include several of this web content sections in the layout):
      #set ($globCounterOfThemeDynamicPortletId = 1000)
      #set ($locArticleGroupId = "10138")
      #set ($locArticleId = "11445")
      #set ($locGroupAndArticleIdForChecking = "$locArticleGroupId" + "" + "$locArticleId" + "")
      $velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
      $velocityPortletPreferences.setValue("group-id", "$locArticleGroupId")
      $velocityPortletPreferences.setValue("article-id", "$locArticleId")
      #set ($locPortletId = "56_INSTANCE_" + $globCounterOfThemeDynamicPortletId)
      #set ($globCounterOfThemeDynamicPortletId = $globCounterOfThemeDynamicPortletId + 1)
      #set($locRenderedPortletContent = $theme.runtime($locPortletId, "", $velocityPortletPreferences.toString()))
      #set ($locCorrectArticleHasBeenReturned = $locRenderedPortletContent.contains($locGroupAndArticleIdForChecking))
      #if ($locCorrectArticleHasBeenReturned)
      ##correct - let it be
      ##incorrect - the article or group Id has been changed - so remove the old porltet preferences record and reinitialize it:
      #set ($locPortletPreferenceService = $serviceLocator.findService("com.liferay.portal.service.PortletPreferencesLocalService"))
      #set ($locPlidLong = $getterUtil.getLong($plid))
      $locPortletPreferenceService.deletePortletPreferences(0, 3, $locPlidLong, $locPortletId)

        1. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0 ... PortletKeys.PREFS_OWNER_ID_DEFAULT, 3 ... PortletKeys.PREFS_OWNER_TYPE_LAYOUT
          #set ($locRenderedPortletContent = $theme.runtime($locPortletId, "", $velocityPortletPreferences.toString()))
          Finally, when the web content portlet instead of loading the wrong content doesn't load content at all, the generated HTML code has the "empty" selector assigned, as in the following code:
          <div id="layout-column_column-2" class="lfr-portlet-column empty"></div>




            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created:
                Days since last comment:
                5 years, 1 week, 4 days ago