本文介绍了在Liferay中以编程方式获取页面的url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在portlet中创建一个链接,以便可以导航到liferay门户中的其他页面.我要这样做是要寻找一个给定页面名称的API(可能是liferay专用的),该API会返回其url(也可以是friendlyURL).

I want to create a link in a portlet so that I can navigate to a different page in the liferay portal. I order to do that I am looking for an API (can be liferay specific) that given a page name, would return it's url (it can be the friendlyURL as well).

推荐答案

用于访问Liferay中的页面的API是LayoutService.但是,页面名称在Liferay中不是唯一的,而且它们是国际化的.因此,除了名称之外,您还需要页面具有一些唯一的属性来检索其url.

The API to access pages in Liferay is the LayoutService. However, page names are not unique in Liferay and furthermore they are internationalized. So you need some unique property for a page to retrieve its url, besides its name.

如果确实只有页面名称,则可以使用LayoutLocalServiceUtil.getLayouts(...)遍历所有Layouts并检查某些属性(在本例中为属性名称).

If you really only have the page name, you can use LayoutLocalServiceUtil.getLayouts(...) to loop over all Layouts and check for some property (in this case its name).

这篇关于在Liferay中以编程方式获取页面的url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 21:03