Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jan Bub
How to get groupId in init method
July 22, 2011 2:37 AM
Answer

Jan Bub

Rank: Junior Member

Posts: 78

Join Date: March 2, 2011

Recent Posts

Hey.

I have createtet some Organizations. I want to create some standard Folders for my Portles in the Document Library when the Portlet ist initialize. Therefore I need the groupId of the Portlet instance. But I have no access to the request. Can anybody help me to get access wo it?
David H Nebinger
RE: How to get groupId in init method
July 22, 2011 5:57 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7238

Join Date: September 1, 2006

Recent Posts

I don't think you'd have access to it at initialization time, because initialization of the portlet might not be tied to an organization at that point.

I'd pursue a 'lazy initialization' way of handling it; when the portlet is processing a request (that comes with the group id), check that the folders exist and create them if they don't.

I'm sure you could even build a fancy caching plan to remember which group ids have generated requests for the portlet and which folders you've either already found or created, so you wouldn't have to go through the check on every request.
Manh Hoang
RE: How to get groupId in init method
February 28, 2012 8:13 PM
Answer

Manh Hoang

Rank: New Member

Posts: 14

Join Date: February 14, 2012

Recent Posts

Hi!
If you want to get Groupid in view.jsp in your own portlet
You can do it by follow steps
In view.jsp you add one lib is:
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<liferay-theme:defineObjects />

When you add this lib. It provide a object is scopeGroupId. This is current group id.
Hope useful for you!