Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Guru k
Site Name in JSP
April 14, 2012 10:01 AM
Answer

Guru k

Rank: Junior Member

Posts: 64

Join Date: February 7, 2012

Recent Posts

Hi,

How to get the current Site Name in JSP.

Thanks
Guru
Hitoshi Ozawa
RE: Site Name in JSP
April 14, 2012 8:11 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<liferay-theme:defineObjects />
long groupId = layout.getGroupId();
Group group = GroupLocalServiceUtil.getGroup(groupId);
String name = group.getName();
Guru k
RE: Site Name in JSP
April 15, 2012 2:05 AM
Answer

Guru k

Rank: Junior Member

Posts: 64

Join Date: February 7, 2012

Recent Posts

Hi Hitoshi,

Thanks for reply... Works as expected.

But the default Liferay site returns Sitename as Guest. how to get the name "Liferay".

Thanks
Hitoshi Ozawa
RE: Site Name in JSP
April 15, 2012 2:37 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Do you mean company name "Liferfay.com"?
Guru k
RE: Site Name in JSP
April 15, 2012 9:55 AM
Answer

Guru k

Rank: Junior Member

Posts: 64

Join Date: February 7, 2012

Recent Posts

My doubt was how Site Name "guest" is mapped as Liferay in GoTo menu.
Guru k
RE: Site Name in JSP
April 18, 2012 10:15 PM
Answer

Guru k

Rank: Junior Member

Posts: 64

Join Date: February 7, 2012

Recent Posts

Yes how to get the Company Name?
Guru k
RE: Site Name in JSP
April 18, 2012 10:29 PM
Answer

Guru k

Rank: Junior Member

Posts: 64

Join Date: February 7, 2012

Recent Posts

Got it ...
1
2long companyId = company.getCompanyId();
3Company company = CompanyLocalServiceUtil.getCompany(companyId);
4String companyName = company.getName();


got the company name with the above code... Thanks for the help emoticon
Ravi Kumar Gupta
RE: Site Name in JSP
April 18, 2012 10:30 PM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

You can get company name similarly as you got group using
1long companyId = layout.getCompanyId();
2Company companyObj = CompanyLocalServiceUtil.getCompany(companyId);
3String companyName = companyObj.getName();


Or, company object is available there already so you can directly use
1
2company.getName()
Guru k
RE: Site Name in JSP
April 18, 2012 10:58 PM
Answer

Guru k

Rank: Junior Member

Posts: 64

Join Date: February 7, 2012

Recent Posts

Thanks Ravi.... used the company object to get the name...