<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Fetch and display web content inside web content in Liferay ce-7.2-ga1</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=114437119" />
  <subtitle>Fetch and display web content inside web content in Liferay ce-7.2-ga1</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=114437119</id>
  <updated>2026-04-04T17:27:48Z</updated>
  <dc:date>2026-04-04T17:27:48Z</dc:date>
  <entry>
    <title>RE: Fetch and display web content inside web content in Liferay ce-7.2-ga1</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119718022" />
    <author>
      <name>Ales Rybak</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119718022</id>
    <updated>2020-08-06T08:28:14Z</updated>
    <published>2020-08-06T08:28:14Z</published>
    <summary type="html">I know I&amp;#39;m late, but others might find it useful.In 7.2 the taglibs are split into smaller ones and it is not well documented, but list could be found here: &lt;a href="https://help.liferay.com/hc/en-us/articles/360029145851-FreeMarker-Taglib-Macros"&gt;https://help.liferay.com/hc/en-us/articles/360029145851-FreeMarker-Taglib-Macros&lt;/a&gt;. In this case you are looking for `liferay-asset`, in FreeMarker you would use it like this:&lt;em&gt;&amp;lt;#assign webContent = webContent.getData()?eval /&amp;gt;&lt;br /&gt;&amp;lt;@&lt;strong&gt;liferay_asset&lt;/strong&gt;[&amp;#34;asset-display&amp;#34;]&lt;br /&gt;        className = webContent.className&lt;br /&gt;        classPK = webContent.getLong(externalContent.classPK, 0)&lt;br /&gt;/&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;​​​​​​​&lt;/em&gt;</summary>
    <dc:creator>Ales Rybak</dc:creator>
    <dc:date>2020-08-06T08:28:14Z</dc:date>
  </entry>
  <entry>
    <title>RE: Fetch and display web content inside web content in Liferay ce-7.2-ga1</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114481506" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114481506</id>
    <updated>2019-07-29T13:31:05Z</updated>
    <published>2019-07-29T13:31:05Z</published>
    <summary type="html">Ok, this is the workaround that I used to solve my issue:&lt;br /&gt;&lt;em&gt;&amp;lt;#assign journalArticleLocalService = serviceLocator.findService(&amp;#34;com.liferay.journal.service.JournalArticleLocalService&amp;#34;) /&amp;gt;&lt;br /&gt;&amp;lt;#assign assetEntryLocalService = serviceLocator.findService(&amp;#34;com.liferay.asset.kernel.service.AssetEntryLocalService&amp;#34;) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webContentData = jsonFactoryUtil.createJSONObject(webContent.getData()) /&amp;gt;&lt;br /&gt;&amp;lt;#assign asset = assetEntryLocalService.getEntry( webContentData.className, getterUtil.getLong( webContentData.classPK ) ) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webArticle = asset.getAssetRenderer().getArticle() /&amp;gt;&lt;br /&gt;&amp;lt;#assign webArticleContent = journalArticleLocalService.getArticleContent( groupId, webArticle.getArticleId(), &amp;#34;&amp;#34;, locale, themeDisplay ) /&amp;gt;&lt;br /&gt;${webArticleContent}&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;By the way, I tested the following method which is also working, but I personally prefer the first one:&lt;br /&gt;&lt;em&gt;&amp;lt;#assign journalArticleLocalService = serviceLocator.findService(&amp;#34;com.liferay.journal.service.JournalArticleLocalService&amp;#34;) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webContentData = jsonFactoryUtil.createJSONObject(webContent.getData()) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webArticle = journalArticleLocalService.getJournalArticleByUuidAndGroupId(webContentData.uuid, groupId) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webArticleContent = journalArticleLocalService.getArticleContent( groupId, webArticle.getArticleId(), &amp;#34;&amp;#34;, locale, themeDisplay ) /&amp;gt;&lt;br /&gt;${webArticleContent}&lt;/em&gt;</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2019-07-29T13:31:05Z</dc:date>
  </entry>
  <entry>
    <title>Fetch and display web content inside web content in Liferay ce-7.2-ga1</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114437118" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114437118</id>
    <updated>2019-07-25T14:58:54Z</updated>
    <published>2019-07-25T14:58:54Z</published>
    <summary type="html">Hi, there!&lt;br /&gt;Some time ago I migrated my project from Liferay 7.1-ce-ga4 to Liferay ce-7.2-ga1 and now I&amp;#39;m experiencing the following problem: I have a custom structure that contains a web content field (of type &lt;em&gt;ddm-journal-article&lt;/em&gt;). My purpose is to fetch and display this web content inside the main article that is an instance of this structure. In the old version of my liferay installation, I had no problems to do this using the following code:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;#assign webContent = webContent.getData()?eval /&amp;gt;&lt;br /&gt;&amp;lt;@liferay_ui[&amp;#34;asset-display&amp;#34;]&lt;br /&gt;        className = webContent.className&lt;br /&gt;        classPK = webContent.getLong(externalContent.classPK, 0)&lt;br /&gt;/&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;​​​​​​​&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;However, in the new version I get an error message saying that  &amp;#39;&lt;em&gt;FreeMarker template error: The following has evaluated to null or missing: ==&amp;gt; liferay_ui[&amp;#34;asset-display&amp;#34;]&lt;/em&gt;&amp;#39;. So obviously this code is not usable anymore. I tried to use the automatically generated code for this field inside the structure template which looks like that:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;#assign webContentData = jsonFactoryUtil.createJSONObject(webContent.getData()) /&amp;gt;&lt;br /&gt;&amp;lt;a href=&amp;#34;${webContent.getFriendlyUrl()}&amp;#34;&amp;gt;&lt;br /&gt;    ${webContentData.title}&lt;br /&gt;&amp;lt;/a&lt;/em&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;Of course, this code did not fit my needs but I checked the output of ${&lt;em&gt;webContentData&lt;/em&gt;} jSON and noticed that I had &lt;em&gt;className&lt;/em&gt; and &lt;em&gt;classPK&lt;/em&gt; data there. Then I decided to fetch and display this journal content using the standard methods of &lt;em&gt;JournalArticleLocalService &lt;/em&gt;. So I proceeded with this code:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;#assign journalArticleLocalService = serviceLocator.findService(&amp;#34;com.liferay.journal.service.JournalArticleLocalService&amp;#34;) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webContentData = jsonFactoryUtil.createJSONObject(webContent.getData()) /&amp;gt;&lt;br /&gt;&amp;lt;#assign webJournalArticle = journalArticleLocalService.getArticle( groupId, &lt;span style="font-size: 18px;"&gt;webContentData&lt;/span&gt;&lt;span style="font-size: 18px;"&gt;.className, getterUtil.getLong(webContentData.classPK) )  /&amp;gt;&lt;br /&gt;&amp;lt;#assign webJournalArticleContent = &lt;/span&gt;&lt;span style="font-size: 18px;"&gt;journalArticleLocalService.getArticleContent( groupId, webJournalArticle.getArticleId(), &amp;#34;&amp;#34;, locale, themeDisplay ) /&lt;/span&gt;&lt;span style="font-size: 18px;"&gt;&amp;gt;&lt;/span&gt;${&lt;span style="font-size: 18px;"&gt;webJournalArticleContent&lt;/span&gt;}&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;This option seemed logic and correct for me, but for my surprise it generated an exception saying that:  &lt;em&gt;No approved JournalArticle exists with the key {groupId=XXXXX, className=com.liferay.journal.model.JournalArticle, classPK=XXXXXX}  &lt;/em&gt;although such an article exists and is approved&lt;em&gt;.&lt;/em&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;I really don&amp;#39;t know how to proceed and solve this issue with ddm-journal-article content, so please any help or advice will be much appreciated.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Eli</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2019-07-25T14:58:54Z</dc:date>
  </entry>
</feed>
