In many liferay projects we are having a requirement to fetch web content and show as per specific location.
If you are thinking to display web content in JSP page, just 2-3 steps far you are :
portal-ext.properties :
acticle.name=YourJournalArticleName
no.actical.text=No Article Exists with this name.
JSP File :
<%
String content = StringPool.BLANK;
try{
String articleName = PropsUtil.get("acticle.name");
JournalArticle journalArticle = JournalArticleLocalServiceUtil.getArticleByUrlTitle (themeDisplay.getScopeGroupId(), articleName);
String articleId = journalArticle.getArticleId();
JournalArticleDisplay articleDisplay = JournalContentUtil.getDisplay (themeDisplay.getScoprGroupId(), articleId,"","",themeDisplay);
content = articleDisplay.getContent();
}Catch(Exception e){
content = PropsUtil.get("no.article.text");
}
%>
<%= content %>
OR
Simply use in LR 6
<liferay-ui:journal-article showTitle="false" articleId="<%= journalArticleId%>"
If you are thinking to display web content in JSP page, just 2-3 steps far you are :
portal-ext.properties :
acticle.name=YourJournalArticleName
no.actical.text=No Article Exists with this name.
JSP File :
<%
String content = StringPool.BLANK;
try{
String articleName = PropsUtil.get("acticle.name");
JournalArticle journalArticle = JournalArticleLocalServiceUtil.getArticleByUrlTitle (themeDisplay.getScopeGroupId(), articleName);
String articleId = journalArticle.getArticleId();
JournalArticleDisplay articleDisplay = JournalContentUtil.getDisplay (themeDisplay.getScoprGroupId(), articleId,"","",themeDisplay);
content = articleDisplay.getContent();
}Catch(Exception e){
content = PropsUtil.get("no.article.text");
}
%>
<%= content %>
OR
Simply use in LR 6
<liferay-ui:journal-article showTitle="false" articleId="<%= journalArticleId%>"