<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<chapter id="faces.messages">
	<title>Messages API</title>
	<para>
		While JSF already has the concept of adding <literal>FacesMessage</literal> objects to the FacesContext in order for those messages to be
		displayed to the user when the view is rendered, Seam Faces takes this concept one step farther with the Messages API provided by the
		Seam International module. Messages are template-based, and can be added directly via the code, or templates can be loaded from resource
		bundles using a <literal>BundleKey</literal>. 
	</para>
	<section id="adding">
		<title>Adding Messages</title>
		<para>
			Consistent with the CDI programming model, the Messages API is provided via bean injection. To add a new message to be displayed to the user,
			inject <literal>org.jboss.seam.international.display.Messages</literal> and call one of the Message factory methods. As mentioned earlier,
			factory methods accept either a plain-text template, or a <literal>BundleKey</literal>, specifying the name of the resource bundle to use, and
			the name of the key to use as a message template.
<programlisting>
@Named
public class Example
{
   @Inject
   Messages messages;

   public String action()
   {
      messages.info("This is an {0} message, and will be displayed to {1}.", "INFO", "the user");
      return null;
   }
}</programlisting><commit_msg>Updated the Messages package in the messages API chapter of the faces documentation<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<chapter id="faces.messages">
	<title>Messages API</title>
	<para>
		While JSF already has the concept of adding <literal>FacesMessage</literal> objects to the FacesContext in order for those messages to be
		displayed to the user when the view is rendered, Seam Faces takes this concept one step farther with the Messages API provided by the
		Seam International module. Messages are template-based, and can be added directly via the code, or templates can be loaded from resource
		bundles using a <literal>BundleKey</literal>. 
	</para>
	<section id="adding">
		<title>Adding Messages</title>
		<para>
			Consistent with the CDI programming model, the Messages API is provided via bean injection. To add a new message to be displayed to the user,
			inject <literal>org.jboss.seam.international.status.Messages</literal> and call one of the Message factory methods. As mentioned earlier,
			factory methods accept either a plain-text template, or a <literal>BundleKey</literal>, specifying the name of the resource bundle to use, and
			the name of the key to use as a message template.
<programlisting>
@Named
public class Example
{
   @Inject
   Messages messages;

   public String action()
   {
      messages.info("This is an {0} message, and will be displayed to {1}.", "INFO", "the user");
      return null;
   }
}</programlisting>
{'fraction_non_alphanumeric': 0.09302325581395349, 'fraction_numerical': 0.005734310289901242, 'mean_word_length': 4.207296849087894, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 2, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3132491', 'n_tokens_mistral': 927, 'n_tokens_neox': 866, 'n_words': 387}