How can I get current group id (or community id) in liferay (java)?
22,055
There is no Community entity in Liferay, it's just another kind of group (see GroupConstants
)
If you have access to a ThemeDisplay
object I think this will give you the Id of the community
long id = themeDisplay.getLayout().getGroupId();
In a struts action you can get ThemeDisplay like this:
ThemeDisplay themeDisplay =
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
where request
can be a RenderRequest
or an ActionRequest
.
Author by
Admin
Updated on August 05, 2020Comments
-
Admin over 3 years
I'm developing portlet with Vaadin in Liferay 6 and I need to get the ID of the community where the portlet is located. How is it done?