How can you tell the difference between two pages in the Liferay App?
So, assume my application has 2 pages and I want to be able to tell which page is first and which is second. What data would I use to accomplish this?
I tried by using the PLID numbers, and this works nicely on a single environment.
But, if I deploy my Liferay app to another environment PLID numbers differ. So, differenting the Liferay pages by their PLID numbers is fine for single environment app, but if my app is to be deployed on multiple environments then this is no longer a valid solution.
So, what is environment-independent way of determing which page is which in Liferay?
While rendering, you can get the current context from a themeDisplay object, retrievable like this:
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
There are plenty of options - but as inherently there is no defined "order" between pages: If you want to use the identical portlet on both pages, you have the option to
PortletPreferences
)