You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ra...@apache.org on 2015/04/02 23:34:05 UTC

svn commit: r1670980 - /deltaspike/site/trunk/content/documentation/jsf.html

Author: rafabene
Date: Thu Apr  2 21:34:05 2015
New Revision: 1670980

URL: http://svn.apache.org/r1670980
Log:
Site checkin for project Apache DeltaSpike Documentation

Modified:
    deltaspike/site/trunk/content/documentation/jsf.html

Modified: deltaspike/site/trunk/content/documentation/jsf.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/jsf.html?rev=1670980&r1=1670979&r2=1670980&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation/jsf.html (original)
+++ deltaspike/site/trunk/content/documentation/jsf.html Thu Apr  2 21:34:05 2015
@@ -200,6 +200,7 @@ body {
 </li>
 <li><a href="#_use_the_module_features">Use the Module Features</a>
 <ul class="sectlevel2">
+<li><a href="#_jsf_messages">JSF Messages</a></li>
 <li><a href="#_multi_window_handling">Multi-Window Handling</a>
 <ul class="sectlevel3">
 <li><a href="#_background">Background</a>
@@ -390,6 +391,45 @@ the corresponding impact.
 </table>
 </div>
 <div class="sect2">
+<h3 id="_jsf_messages">JSF Messages</h3>
+<div class="paragraph">
+<p>DeltaSpike provides an injectable component for typesafe FacesMessages.</p>
+</div>
+<div class="paragraph">
+<p>Is provides an integration with <a href="core.html#_messages_and_i18n">MessageBundle</a> making the use of JSF messages and I18N simple and type-safe.</p>
+</div>
+<div class="paragraph">
+<p>Usage:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@MessageBundle</span>
+<span class="directive">public</span> <span class="type">interface</span> <span class="class">Messages</span>
+{
+    <span class="annotation">@MessageTemplate</span>(<span class="string"><span class="delimiter">&quot;</span><span class="content">Welcome to DeltaSpike</span><span class="delimiter">&quot;</span></span>)
+    <span class="predefined-type">String</span> welcomeToDeltaSpike();
+}
+
+ <span class="annotation">@Model</span>
+ <span class="directive">public</span> <span class="type">class</span> <span class="class">MyJSFBean</span>
+ {
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> JsfMessage&lt;Messages&gt; messages;
+
+    ...
+    messages.addInfo().welcomeToDeltaSpike();
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>MessageBundle methods which are used as JsfMessage can return a <code>org.apache.deltaspike.core.api.message.Message</code> or a String.
+In case of a String we use it for both the summary and detail information on the FacesMessage.</p>
+</div>
+<div class="paragraph">
+<p>If a Message is returned, we lookup the 'detail' and 'summary' categories (see <code>org.apache.deltaspike.core.api.message.Message#toString(String)</code> for creating the FacesMessage.</p>
+</div>
+</div>
+<div class="sect2">
 <h3 id="_multi_window_handling">Multi-Window Handling</h3>
 <div class="sect3">
 <h4 id="_background">Background</h4>