deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r897830 - in /websites/staging/deltaspike/trunk/content: ./ jsf.html
Date Thu, 13 Feb 2014 22:44:47 GMT
Author: buildbot
Date: Thu Feb 13 22:44:47 2014
New Revision: 897830

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/jsf.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Feb 13 22:44:47 2014
@@ -1 +1 @@
-1568069
+1568078

Modified: websites/staging/deltaspike/trunk/content/jsf.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/jsf.html (original)
+++ websites/staging/deltaspike/trunk/content/jsf.html Thu Feb 13 22:44:47 2014
@@ -120,7 +120,14 @@
 <li><a href="#based-scopes">Based Scopes</a></li>
 </ul>
 </li>
-<li><a href="#scopes-todo">Scopes (TODO)</a></li>
+<li><a href="#scopes-todo">Scopes (TODO)</a><ul>
+<li><a href="#windowscoped">@WindowScoped</a></li>
+<li><a href="#viewaccessscoped">@ViewAccessScoped</a></li>
+<li><a href="#groupedconversationscoped">@GroupedConversationScoped</a></li>
+<li><a href="#viewscoped">@ViewScoped</a></li>
+<li><a href="#jsf-20-scopes">JSF 2.0 Scopes</a></li>
+</ul>
+</li>
 <li><a href="#type-safe-view-configs">Type-safe View-Configs</a><ul>
 <li><a href="#intro_1">Intro</a></li>
 <li><a href="#motivation">Motivation</a></li>
@@ -170,7 +177,6 @@
 <li><a href="#sub-conversation-groups">Sub-Conversation-Groups</a></li>
 </ul>
 </li>
-<li><a href="#jsf-managedbean-to-cdi-mapping-todo">JSF ManagedBean to CDI mapping
(TODO)</a></li>
 <li><a href="#converter-validator-injection-todo">Converter &amp; Validator
Injection (TODO)</a></li>
 <li><a href="#event-broadcasting-todo">Event broadcasting (TODO)</a><ul>
 <li><a href="#beforejsfrequest-afterjsfrequest">BeforeJsfRequest / AfterJsfRequest</a></li>
@@ -323,12 +329,42 @@ The best way, to apply it for all views,
 <li>@GroupedConversationScoped</li>
 </ul>
 <h1 id="scopes-todo">Scopes (TODO)</h1>
+<h2 id="windowscoped">@WindowScoped</h2>
+<p>The window-scope is like a session per window. That means that the data is bound
to a window/tab and it not shared between windows (like the session scope does). Usually you
need the window-scope instead of the session-scope. There aren't a lot of use-cases which
need shared data between windows.</p>
+<div class="codehilite"><pre><span class="nd">@WindowScoped</span>
+<span class="kd">public</span> <span class="kd">class</span> <span
class="nc">PreferencesBean</span> <span class="kd">implements</span>
<span class="n">Serializable</span>
+<span class="o">{</span>
+    <span class="c1">//...</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<h2 id="viewaccessscoped">@ViewAccessScoped</h2>
+<p>In case of conversations you have to un-scope beans manually (or they we be terminated
automatically after a timeout). However, sometimes you need beans with a lifetime which is
as long as needed and as short as possible - which are terminated automatically (as soon as
possible). In such an use-case you can use this scope. The simple rule is, as long as the
bean is referenced by a page - the bean will be available for the next page (if it's used
again the bean will be forwarded again). It is important that it's based on the view-id of
a page (it isn't based on the request) so e.g. Ajax requests <b>don't</b> trigger
a cleanup if the request doesn't access all view-access scoped beans of the page. That's also
the reason for the name @<em>View</em>AccessScoped.</p>
+<div class="codehilite"><pre><span class="nd">@ViewAccessScoped</span>
+<span class="kd">public</span> <span class="kd">class</span> <span
class="nc">WizardBean</span> <span class="kd">implements</span> <span
class="n">Serializable</span>
+<span class="o">{</span>
+    <span class="c1">//...</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>Hint: <br/>
+@ViewAccessScoped beans are best used in conjunction with the <code>CLIENTWINDOW</code>
window handling, which ensures a clean browser-tab separation without touching the old windowId.
Otherwise a 'open in new tab' on a page with a @ViewAccessScoped bean might cause the termination
(and re-initialization) of that bean.</p>
+<h2 id="groupedconversationscoped">@GroupedConversationScoped</h2>
+<p>See <a href="#grouped-conversations">(Grouped-)Conversations</a></p>
+<h2 id="viewscoped">@ViewScoped</h2>
+<p>DeltaSpike provides an CDI context for the JSF 2.0/2.1 @javax.faces.bean.ViewScoped.
You can simply annotate your bean with @javax.faces.bean.ViewScoped and @Named.</p>
+<h2 id="jsf-20-scopes">JSF 2.0 Scopes</h2>
+<p>JSF 2.0 introduced new annotations as well as a new scope - the View Scope. CODI
allows to use all the CDI mechanisms in beans annotated with:</p>
 <ul>
-<li>@WindowScoped</li>
-<li>@ViewAccessScoped</li>
-<li>@GroupedConversationScoped</li>
-<li>@ViewScoped</li>
+<li>javax.faces.bean.ApplicationScoped</li>
+<li>javax.faces.bean.SessionScoped</li>
+<li>javax.faces.bean.RequestScoped</li>
+<li>javax.faces.bean.ViewScoped</li>
 </ul>
+<p>Furthermore, the managed-bean annotation (javax.faces.bean.ManagedBean) is mapped
to @Named from CDI.</p>
+<p>All these annotations are mapped automatically. So you won't face issues, if you
import a JSF 2 annotation instead of the corresponding CDI annotation.</p>
 <h1 id="type-safe-view-configs">Type-safe View-Configs</h1>
 <h2 id="intro_1">Intro</h2>
 <p>Type-safe view-configs are static configs which can be used in combination with
every view-technology which is based on Java.
@@ -1244,7 +1280,6 @@ A sub-group is just a class or an interf
 
 
 <p>In the listing above all beans which implement the Wizard interface will be closed
as soon as you close the ImplicitSubGroup.</p>
-<h1 id="jsf-managedbean-to-cdi-mapping-todo">JSF ManagedBean to CDI mapping (TODO)</h1>
 <h1 id="converter-validator-injection-todo">Converter &amp; Validator Injection
(TODO)</h1>
 <h1 id="event-broadcasting-todo">Event broadcasting (TODO)</h1>
 <h2 id="beforejsfrequest-afterjsfrequest">BeforeJsfRequest / AfterJsfRequest</h2>



Mime
View raw message