Combination View Flat View Tree View
Threads [ Previous | Next ]
Micael Ericsson
Problem retrieving article
August 9, 2017 6:55 AM

Micael Ericsson

Rank: Regular Member

Posts: 157

Join Date: December 11, 2012

Recent Posts

I have created an article for our site. Now I wish to retrieve the content of that article in my JSF portlet.
The article ha title "Stoppmeddelande". First try was to get the article was with the following code:
2FacesContext context = FacesContext.getCurrentInstance();
3PortletRequest portletRequest = (PortletRequest) context.getExternalContext().getRequest();
4ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
5long groupId = themeDisplay.getCompanyGroupId();
6JournalArticle article = JournalArticleServiceUtil.getArticleByUrlTitle(groupId, STOPP_MEDDELANDE);

Running this I got a PortalException with information that article with group xx and title 'Stoppmeddelande' could not be found.
Looking at my article in admin of site I found the following information in the url:

The displayed groupid was not matching the one I used getting the article. At least not according to the exception.
Next try was to get Article with above groupid and articleid:
1JournalArticle article = JournalArticleServiceUtil.getArticle(201182L, "45085");

This didn't work either:
No JournalArticle exists with the key {groupId=201182, articleId=45085, status=8}

What am I doing wrong here?

Liferay 6.2, JSF 2.2 portlet. I am not sure why I use themeDisplay but the sample found on internet was using it. emoticon
Neil Griffin
RE: Problem retrieving article
August 9, 2017 7:24 AM

Neil Griffin


Rank: Liferay Legend

Posts: 2531

Join Date: July 26, 2005

Recent Posts

Hi Micael,

I recommend that you try themeDisplay.getScopeGroupId() instead.

Kind Regards,


Participate in the State of Liferay Community 2017. Help the community and even win some prizes!