Fórum

Properties file

thumbnail
Soukaina HAJI, modificado 9 Anos atrás.

Properties file

Regular Member Postagens: 195 Data de Entrada: 17/06/14 Postagens Recentes
Hello,

I created a properties file in a hook project and I need to access those properties I don't know the syntax !

thank you
Liferay 6.2 ce ga2
thumbnail
David H Nebinger, modificado 9 Anos atrás.

RE: Properties file

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Again, hook project and Liferay ROOT web app (where jsp hooks are applied) are two different places and you cannot cross that boundary.

To make a property to use in a hook, you should put into portal-ext.properties.
thumbnail
Soukaina HAJI, modificado 9 Anos atrás.

RE: Properties file

Regular Member Postagens: 195 Data de Entrada: 17/06/14 Postagens Recentes
Ok thank you and how should I call the properties ?
thumbnail
David H Nebinger, modificado 9 Anos atrás.

RE: Properties file

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
If the properties are loaded into portal-ext.properties, you can access them through PropsUtil.
thumbnail
Andew Jardine, modificado 9 Anos atrás.

RE: Properties file

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
David is correct however I might also suggest using the --

PrefsPropsUtil.getXXX(companyId, ..., ...);

call so that you can future proof it in the event you need to use it for multiple instances down the road and need the value to be different on an instance by instance basis. Using the PrefsPropsUtil with a company id will allow you to specify company specific properties files.
thumbnail
David H Nebinger, modificado 9 Anos atrás.

RE: Properties file

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Andrew is also correct, and I would add that you should leverage GetterUtil for your type conversion emoticon
Anonymous Anonymous, modificado 9 Anos atrás.

RE: Properties file

Regular Member Postagens: 127 Data de Entrada: 16/09/19 Postagens Recentes
Hi

if you are accessing the language properties you have to use

LanguageUtil.get(locale,"pass_the_key","");

if in .vm file you may use
$languageUtil.get($locale,"pass_the_key","")
thumbnail
David H Nebinger, modificado 9 Anos atrás.

RE: Properties file

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
enayath ulla:
if you are accessing the language properties you have to use,,,


WTF? How is this related to the question and who gave it a thumbs up?