26 April, 2012

Display web content in JSP Page

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 :

no.actical.text=No Article Exists with this name.

JSP File :

String content = StringPool.BLANK;
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 %>


Simply use in LR 6 

<liferay-ui:journal-article showTitle="false" articleId="<%= journalArticleId%>"

Rate Me:

0 Discussion:

Post a Comment

Your Comments on this post

Google Pay Referral Code s34xJ – Earn 180 INR Per Referral

You can use  Google Pay Referral Code s34xJ  and sign up on  Google pay  . Google has increased its referral commission from 51 to 180 INR. ...