SAPUI5 provides a central management of UI and server messages.
Messages notify the user about specific states of the application. The following two message types exist:
UI messages (client side) are created from the input validation and by the application itself.
Server messages are managed by the server and are changed every time the back end responds to a request.
A message contains at least the following information:
ID: The ID is usually set automatically on message creation.
Type: Possible types are error, warning, and info; see sap.ui.core.MessageType in the API reference
Target: Describes to what part of the application the message applies; if the target is empty, the message applies to the entire application
Message processor: Object that handles the message in the application
Message text: Text that is displayed to the user
In addition to this information, a message can contain the following optional information:
Description: Message long text
Code: Machine-readable version of the message; this is usually provided by the back end to allow to look-up details
technical property: This property is set if a technical error occurs; it is usually set if an error code is sent from the back end, like a 404
persistent property: If this property is set to true, the messages are not deleted automatically; the application handles the life cycle of these messages
The MessageManager handles the message life cycle, which is different for UI and server messages: UI messages are added with a target referencing a control and its specific property. The messages are kept until a validation message for the property is created and assigned. If new data for the same property is received from the server, the UI messages are erased unless their persistent property is set to true. Server messages are kept until a message from the server for the same path arrives. The server always sends all messages for a specific target, which means that all current messages are replaced with the ones sent by the server.