留言板

Liferay DXP portlet.properties

thumbnail
Ravi Darji,修改在7 年前。

Liferay DXP portlet.properties

Junior Member 帖子: 56 加入日期: 14-5-14 最近的帖子
Hi Everyone,

As we are using PortletProps.get("property.name") in liferay 6.2 to get property value from portlet's portlet.properties file,

Is someone knows that how can i do same in liferay DXP?

Thanks & Regards,
Ravi Darji
thumbnail
David H Nebinger,修改在7 年前。

RE: Liferay DXP portlet.properties

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
It is available for portlet wars, but for OSGi you should be switching over to Configuration Admin (OSGi). There's doco in dev.liferay.com for this and examples in the Liferay source.
thumbnail
Scott Lee,修改在6 年前。

RE: Liferay DXP portlet.properties

Junior Member 帖子: 55 加入日期: 06-9-26 最近的帖子
thumbnail
Liferay Dev,修改在6 年前。

RE: Liferay DXP portlet.properties

Junior Member 帖子: 81 加入日期: 15-5-17 最近的帖子
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");
thumbnail
David H Nebinger,修改在6 年前。

RE: Liferay DXP portlet.properties

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Liferay Dev:
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");


What? This is totally confusing. You're going to use the portal class loader, the one where none of your code is actually running? And what is "portlet"? Did you mean for this to be a placeholder for a portlet name or id or service or what?

Answering forum questions is always welcome, but keep in mind that there are people reading these posts with different levels of experience and often you need to provide some contextual details. A newbie trying this code is going to be completely stymied trying to understand why it is not working or trying to adapt it to their project.








Come meet me at Devcon 2017 or 2017 LSNA!
thumbnail
Liferay Dev,修改在6 年前。

RE: Liferay DXP portlet.properties

Junior Member 帖子: 81 加入日期: 15-5-17 最近的帖子
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration( get Portlet level class loader , "portlet");