SeamFramework.orgCommunity Documentation
There are currently two ways to create a message within the module.
The first would mostly be used when you don't want to add the generated message directly to the UI, but want to log it out, or store it somewhere else
@Inject
MessageFactory factory;
public String getMessage()
{
MessageBuilder builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");#
return builder.build().getText();
}
The second is to add the message to a list that will be returned to the UI for display.
@Inject
Messages messages;
public void setMessage()
{
messages.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
}
Either of these methods supports the four message levels which are info, warning, error and fatal.
Both the MessageFactory and Messages classes support four ways in which to create a Message:
Examples for each of these are:
messages.info("Simple Text");
messages.info("Simple Text with {0} parameter", 1);
messages.info(new BundleKey("org.jboss.international.seam.test.TestBundle", "key1"));
messages.info(new BundleKey("org.jboss.international.seam.test.TestBundle", "key2"), 1);
The above examples assume that there is a properties file existing at org.jboss.international.seam.test.TestBundle.properties
with key1
being a simple text string
and key2
including a single parameter.