Creating Messages |
![]() ![]() ![]() |
In MoreMotion environment creating a message to display to the end user means creating an ADOM. If you want to warn the end user about an invalid input you can create an ADOM that contains the message text.
To show the message on the page you can bind the value of a text element to /msg/text node as follows. <xsl:value-of select="/root//msg/text" /> As the requirements increase, like providing a message id, message details, handling multiple messages and supporting multi-lingual message, this simple example can get complicated.
Creating Multi-Lingual Messages using MoreMotion API To create multi-lingual messages, you can use the provided methods in MoreMotion API. // In a Service request.createMessage(unit-name, message-id, message-arguments, message-details);
// In a Process createMessage(message-id, message-arguments, message-details);
createMessage() methods create a new Request ADOM for the message if not already created and adds the given message in it. unit-name The Name of the reporting unit. This name will be used to name the ADOM to be created and the resource associated with it. This parameter is not available in the process createMessage() method because the unit-name is taken from the process definition file. message-id Either a message text or a resource Id. The message text will be taken from the resource file <unit-name>.res with this Id. If the resource file has multi-language support then the correct language version of the message text will be taken from the resource file depending on the language of the page to be displayed. If no resource is found with the given id in the resource file then message-id is used as the message text. message-arguments The message arguments which will be used to replace argument symbols (%0, %1, etc.) existing in the message text. message-details Either an Exception object that keeps the original exception or a String object that keeps the message details. The XML structure of the created message datasource is as follows:
Example:
The Message Id "MISSING_TABLE" should exist in resource file ROOT/WEB-INF/MM-INF/resources/myunit.res. myunit.res file
|