Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Smilelws2010 lwz
Service builder - Impl class - portlet ID - help needed
April 17, 2013 1:11 PM
Answer

Smilelws2010 lwz

Rank: Regular Member

Posts: 154

Join Date: December 16, 2010

Recent Posts

HI,

I have XXXServiceImpl.java class, where I have a method sendEmail( string abc, String xyz)

I need to get portlet ID in this method. I do not have any request object available as the method is being invoked/called from a web content (structure, template) using service locator.

I tried preference mode for manually setting the portlet id, but to access that in the impl class also I need request object

I have the portlet instaceable as true, so the portlet ID will be different for the multiple instances of portlet in the same page. And I need portletID to create a url to navigate to a particular jsp


Please help. I am kind off stuck.

Thanks
Smile
David H Nebinger
RE: Service builder - Impl class - portlet ID - help needed
April 17, 2013 1:42 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7850

Join Date: September 1, 2006

Recent Posts

Not possible.

Your SB is running in a completely different context, so it has no visibility whatsoever on who's calling it (i.e. which portlet it was called from).

You'll have to pass the portlet id as a parameter to the method, which means you'll need to figure out how to do that within your template/structure.
Smilelws2010 lwz
RE: Service builder - Impl class - portlet ID - help needed
April 18, 2013 3:55 AM
Answer

Smilelws2010 lwz

Rank: Regular Member

Posts: 154

Join Date: December 16, 2010

Recent Posts

Thanks David.

One quick question, is it possible in general to get the id of another portlet in a structure and template. We can always hard code it but then it is dynamic.

Or is there any way to create a url in SB impl method other than passing request, or id paramerter.


Thank you