Forums de discussion

Read values from portal-ext.properties in liferay Dxp

Neha A, modifié il y a 6 années.

Read values from portal-ext.properties in liferay Dxp

New Member Publications: 7 Date d'inscription: 13/11/17 Publications récentes
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, modifié il y a 6 années.

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

Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentes
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, modifié il y a 6 années.

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

New Member Publications: 7 Date d'inscription: 13/11/17 Publications récentes
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, modifié il y a 6 années.

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

Junior Member Publications: 76 Date d'inscription: 02/02/11 Publications récentes
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, modifié il y a 6 années.

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

New Member Publications: 7 Date d'inscription: 13/11/17 Publications récentes
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, modifié il y a 6 années.

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

Junior Member Publications: 76 Date d'inscription: 02/02/11 Publications récentes
Can you please also mention exact Liferay version (SP/GA) ?
Please also share example portlet.

Thanks,
Ankit
Jinesh Shah, modifié il y a 3 années.

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

New Member Envoyer: 1 Date d'inscription: 26/05/20 Publications récentes
<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>