Question

I'm trying to figure out how to link to another page within the same liferay site.

Obviously I could hardcode the url in my portlet's view but I'm worried about having to update all of my portlets in case the friendly url changes in the future.

I know the name of the page I'm trying to link to, but what if the page name changes too?

I've found infinity of classes that have methods that return friendlyUrls, such as PortalUtil, LayoutLocalServiceUtil, and even LayoutFriendlyURLLocalServiceUtil, but they all require parameters that I'm not sure how to obtain.

Is there a standard way of obtaining friendly urls in liferay?

Était-ce utile?

La solution

If you want to link to another Page, you can either use LayoutId or friendly url names. Both are unique for each companyId, so you are going to be pretty safe using them.

You can set the friendlyUrl as a PortletConfig parameters, so you can set them on portlet Level, and you won't have them hard-coded in your Portlet. Alternatively, you can also save them as custom params in portal-ext.properties (will apply for all portlets of that portal).

Now, that's a lot of code for this, so if you're dealing with specific problems, like creating Portlet Configuration or Reading portal-ext.properties, or creating renderUrls programatically, you should start new questions

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top