Main messages pack

Hello everyone. I would like to insert and retrieve a value from the main message pack. I inserted a string (test=xxx) into the messages.properties file and tried to recover it with the code messages.formatMessage(messages.getMainMessagePack(), “test”). I can’t get the value xxx, where am I going wrong?
I have also others strings that i’d like to retrieve in the same file (for example application.logoLabel) but nothing…Can i have a little help?
Cheers

Hi,
Your code looks correct.
Probably, you’ve put the message to one module (e.g. web), and then are trying to read the message from inside the other module (e.g. in a ServiceBean in core module).
But messages between core and web modules are independent.

Also, the more convenient method in your case in getMainMessage(), as stated in the documentation:
https://doc.cuba-platform.com/manual-7.2/messages.html

Hi Alexander, yes i have put the message in main message pack (look at the attachment) and i’m trying to read it by a servicebean…Is it not possible?
immagine

Messages from web module will not be visible from the core module.

You can put these messages to any message pack in the global or core module.
The global module is ideal if you want these messages be accessible both from web and core.
see modules diagram: Application Modules - CUBA Platform. Developer’s Manual