Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Prasanna Raj
Complete Service builder working example portlet
October 31, 2012 10:50 AM
Answer

Prasanna Raj

Rank: Junior Member

Posts: 69

Join Date: January 30, 2012

Recent Posts

Hello All,
I'm trying to work with the service builder of Liferay for the first time. I'm looking for a working example of a portlet displaying records in the front end fetched from DB using service builder. I looked at the following url:

http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/service-build-5

This helped me get started with Service builders. How can I fetch the values from the util classes generated and use it in my JSP to display values in the front?

Note: All my North-East friends in US, Be careful! Be Safe! Take care!!

Thanks.
PR
Samuel Kong
RE: Complete Service builder working example portlet
October 31, 2012 8:49 PM
Answer

Samuel Kong

LIFERAY STAFF

Rank: Liferay Master

Posts: 982

Join Date: March 10, 2008

Recent Posts

Try the Sample Service Builder portlet at http://github.com/liferay/liferay-plugins/tree/master/portlets/sample-service-builder-portlet
Hitoshi Ozawa
RE: Complete Service builder working example portlet
October 31, 2012 9:05 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

How can I fetch the values from the util classes generated and use it in my JSP to display values in the front?


You just have to call one of the impl method in the jsp. I think there was an example in the online Developer service builder manual you've read.
Service Builder just generates some classes and methods which you can customize. Just call these methods as you'll call any other java methods from jsp.

example:
<%= UserLocalServiceImpl.getFullName(userId) %>
Prasanna Raj
RE: Complete Service builder working example portlet
November 7, 2012 7:38 PM
Answer

Prasanna Raj

Rank: Junior Member

Posts: 69

Join Date: January 30, 2012

Recent Posts

Hey Samuel,

Thanks for the response, The example shows service.xml creating a new table in LR DB.
Is there a way I can use any existing table of LR like users or roles and just display the first say 5 rows or 10 rows in the UI?

Thanks.
David H Nebinger
RE: Complete Service builder working example portlet
November 7, 2012 8:56 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7252

Join Date: September 1, 2006

Recent Posts

Sure, check out the UserLocalServiceImpl class and the methods it exposes.
Samuel Kong
RE: Complete Service builder working example portlet
November 8, 2012 12:49 AM
Answer

Samuel Kong

LIFERAY STAFF

Rank: Liferay Master

Posts: 982

Join Date: March 10, 2008

Recent Posts

There's probably no need to use service builder. Just call UserLocalServiceUtil.getCompanyUsers(companyId, start, end)