Foren

Read values from portal-ext.properties in liferay Dxp

Neha A, geändert vor 6 Jahren.

Read values from portal-ext.properties in liferay Dxp

New Member Beiträge: 7 Beitrittsdatum: 13.11.17 Neueste Beiträge
I am trying to read values from portal-ext.properties in lifeary dxp but its giving me null value.
Please suggest me any solution for this.
Thanks in advance.
thumbnail
Olaf Kock, geändert vor 6 Jahren.

RE: Read values from portal-ext.properties in liferay Dxp

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
it helps to know what you're currently doing. Might even give you some insight into what you were missing, rather than just the single line of code.
Neha A, geändert vor 6 Jahren.

RE: Read values from portal-ext.properties in liferay Dxp

New Member Beiträge: 7 Beitrittsdatum: 13.11.17 Neueste Beiträge
here is how i am trying to read values (as we were doing earlier in liferay 6.2)
Have created one key in portal-ext.properties as ldm.test.data=Sample data
String testData = PropsUtil.get("ldm.test.data");
package for propsutil is com.liferay.portal.kernel.util.PropsUtil;

at the end i m getting testData as null .

note : I am trying to do this lifeary dxp (is there is any different approach for this in liferay dxp )
thumbnail
ANKIT SRIVASTAVA, geändert vor 6 Jahren.

RE: Read values from portal-ext.properties in liferay Dxp

Junior Member Beiträge: 76 Beitrittsdatum: 02.02.11 Neueste Beiträge
Hi Neha,

Which module type are you using? As I tried with mvc portlet and can read value of props from portal-ext.properties.
Are you using portal-ext from Liferay Home?

Thanks,
Ankit
Neha A, geändert vor 6 Jahren.

RE: Read values from portal-ext.properties in liferay Dxp

New Member Beiträge: 7 Beitrittsdatum: 13.11.17 Neueste Beiträge
spring mvc portlet type
it is placeed in war folder in Liferay workspace

Even tried with
project templete name MVC-portlet
for this same result , null value .

below is lines of code what i am doing
in render method
String newProp = PropsUtil.get("ldm.test.data");
System.out.println("Property value " + newProp);

portal-ext in liferay home
thumbnail
ANKIT SRIVASTAVA, geändert vor 6 Jahren.

RE: Read values from portal-ext.properties in liferay Dxp

Junior Member Beiträge: 76 Beitrittsdatum: 02.02.11 Neueste Beiträge
Can you please also mention exact Liferay version (SP/GA) ?
Please also share example portlet.

Thanks,
Ankit
Jinesh Shah, geändert vor 3 Jahren.

RE: Read values from portal-ext.properties in liferay Dxp

New Member Beitrag: 1 Beitrittsdatum: 26.05.20 Neueste Beiträge
<p>Create&nbsp;one variable&nbsp;in portal-ext.properties as test.data=Sample data<br />
Import package for propsutil named&nbsp;&quot;com.liferay.portal.kernel.util.PropsUtil&quot;;<br />
String data&nbsp;= PropsUtil.get(&quot;test.data&quot;);<br />
Now restart your server to get the successful response from portal-ext</p>