[seam-commits] Seam SVN: r12992 - in modules/faces/trunk: docs/reference/src/main/docbook/en-US and 4 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jun 2 15:59:01 EDT 2010


Author: lincolnthree
Date: 2010-06-02 15:59:00 -0400 (Wed, 02 Jun 2010)
New Revision: 12992

Added:
   modules/faces/trunk/docs/reference/src/main/docbook/en-US/messages.xml
   modules/faces/trunk/impl/build/
   modules/faces/trunk/impl/build/classes/
Modified:
   modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
   modules/faces/trunk/docs/reference/src/main/docbook/en-US/installation.xml
   modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml
   modules/faces/trunk/docs/reference/src/main/docbook/en-US/scopes.xml
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamExternalContext.java
   modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
   modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml
Log:
Documented the Messages API
Documented the new Flash Scope implementation
Fixed faces-config.xml ordering to enable proper NavigationHandler ordering for FlashScope

Modified: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java	2010-06-02 19:59:00 UTC (rev 12992)
@@ -25,6 +25,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.el.ValueReference;
 import javax.faces.FacesException;
 import javax.faces.application.FacesMessage;
@@ -45,19 +46,24 @@
 import javax.validation.ValidatorFactory;
 
 /**
- * <strong>UIInputContainer</strong> is a supplamental component for a JSF 2.0 composite component
- * encapsulating one or more input components (<strong>EditableValueHolder</strong>),
- * their corresponding message components (<strong>UIMessage</strong>) and
- * a label (<strong>HtmlOutputLabel</strong>). This component takes care of wiring the
+ * <strong>UIInputContainer</strong> is a supplemental component for a JSF 2.0
+ * composite component encapsulating one or more input components
+ * (<strong>EditableValueHolder</strong>), their corresponding message
+ * components (<strong>UIMessage</strong>) and a label
+ * (<strong>HtmlOutputLabel</strong>). This component takes care of wiring the
  * label to the first input and the messages to each input in sequence. It also
- * assigns two implicit attribute values, "required" and "invalid" to indicate that
- * a required input field is present and whether there are any validation errors, respectively.
- * To determine if a input field is required, both the required attribute is consulted and
- * whether the property has Bean Validation constraints.
- * Finally, if the "label" attribute is not provided on the composite component, the
- * label value will be derived from the id of the composite component, for convenience.
- *
- * <p>Composite component definition example (minus layout):</p>
+ * assigns two implicit attribute values, "required" and "invalid" to indicate
+ * that a required input field is present and whether there are any validation
+ * errors, respectively. To determine if a input field is required, both the
+ * required attribute is consulted and whether the property has Bean Validation
+ * constraints. Finally, if the "label" attribute is not provided on the
+ * composite component, the label value will be derived from the id of the
+ * composite component, for convenience.
+ * 
+ * <p>
+ * Composite component definition example (minus layout):
+ * </p>
+ * 
  * <pre>
  * &lt;cc:interface componentType="org.jboss.seam.faces.InputContainer"/>
  * &lt;cc:implementation>
@@ -68,19 +74,24 @@
  *   &lt;h:message id="message" errorClass="invalid message" rendered="#{cc.attrs.invalid}"/>
  * &lt;/cc:implementation>
  * </pre>
- *
- * <p>Composite component usage example:</p>
+ * 
+ * <p>
+ * Composite component usage example:
+ * </p>
+ * 
  * <pre>
  * &lt;example:inputContainer id="name">
  *   &lt;h:inputText id="input" value="#{person.name}"/>
  * &lt;/example:inputContainer>
  * </pre>
- *
- * <p>Possible enhancements:</p>
+ * 
+ * <p>
+ * Possible enhancements:
+ * </p>
  * <ul>
  * <li>append styleClass "invalid" to label, inputs and messages when invalid</li>
  * </ul>
- *
+ * 
  * @author Dan Allen
  */
 @FacesComponent(UIInputContainer.COMPONENT_TYPE)
@@ -101,16 +112,16 @@
    {
       beanValidationPresent = isClassPresent("javax.validation.Validator");
    }
-   
+
+   @Override
    public String getFamily()
    {
       return UINamingContainer.COMPONENT_FAMILY;
    }
 
    /**
-    * The name of the auto-generated composite component attribute
-    * that holds a boolean indicating whether the the template contains
-    * an invalid input.
+    * The name of the auto-generated composite component attribute that holds a
+    * boolean indicating whether the the template contains an invalid input.
     */
    public String getInvalidAttributeName()
    {
@@ -118,9 +129,8 @@
    }
 
    /**
-    * The name of the auto-generated composite component attribute
-    * that holds a boolean indicating whether the template contains
-    * a required input.
+    * The name of the auto-generated composite component attribute that holds a
+    * boolean indicating whether the template contains a required input.
     */
    public String getRequiredAttributeName()
    {
@@ -128,10 +138,9 @@
    }
 
    /**
-    * The name of the composite component attribute that
-    * holds the string label for this set of inputs. If the
-    * label attribute is not provided, one will be generated
-    * from the id of the composite component or, if the id is
+    * The name of the composite component attribute that holds the string label
+    * for this set of inputs. If the label attribute is not provided, one will
+    * be generated from the id of the composite component or, if the id is
     * defaulted, the name of the property bound to the first input.
     */
    public String getLabelAttributeName()
@@ -140,10 +149,9 @@
    }
 
    /**
-    * The name of the auto-generated composite component attribute
-    * that holds the elements in this input container. The
-    * elements include the label, a list of inputs and a cooresponding
-    * list of messages.
+    * The name of the auto-generated composite component attribute that holds
+    * the elements in this input container. The elements include the label, a
+    * list of inputs and a cooresponding list of messages.
     */
    public String getElementsAttributeName()
    {
@@ -152,8 +160,8 @@
 
    /**
     * The name of the composite component attribute that holds a boolean
-    * indicating whether the component template should be enclosed in
-    * an HTML element, so that it be referenced from JavaScript.
+    * indicating whether the component template should be enclosed in an HTML
+    * element, so that it be referenced from JavaScript.
     */
    public String getEncloseAttributeName()
    {
@@ -181,7 +189,7 @@
    }
 
    @Override
-   public void encodeBegin(FacesContext context) throws IOException
+   public void encodeBegin(final FacesContext context) throws IOException
    {
       if (!isRendered())
       {
@@ -191,7 +199,7 @@
       super.encodeBegin(context);
 
       InputContainerElements elements = scan(getFacet(UIComponent.COMPOSITE_FACET_NAME), null, context);
-      //assignIds(elements, context);
+      // assignIds(elements, context);
       wire(elements, context);
 
       getAttributes().put(getElementsAttributeName(), elements);
@@ -201,7 +209,8 @@
          getAttributes().put(getInvalidAttributeName(), true);
       }
 
-      // set the required attribute, but only if the user didn't already assign it
+      // set the required attribute, but only if the user didn't already assign
+      // it
       if (!getAttributes().containsKey(getRequiredAttributeName()) && elements.hasRequiredInput())
       {
          getAttributes().put(getRequiredAttributeName(), true);
@@ -219,7 +228,7 @@
    }
 
    @Override
-   public void encodeEnd(FacesContext context) throws IOException
+   public void encodeEnd(final FacesContext context) throws IOException
    {
       if (!isRendered())
       {
@@ -234,7 +243,7 @@
       }
    }
 
-   protected void startContainerElement(FacesContext context) throws IOException
+   protected void startContainerElement(final FacesContext context) throws IOException
    {
       context.getResponseWriter().startElement(getContainerElementName(), this);
       String style = (getAttributes().get("style") != null ? getAttributes().get("style").toString().trim() : null);
@@ -250,12 +259,12 @@
       context.getResponseWriter().writeAttribute(HTML_ID_ATTR_NAME, getClientId(context), HTML_ID_ATTR_NAME);
    }
 
-   protected void endContainerElement(FacesContext context) throws IOException
+   protected void endContainerElement(final FacesContext context) throws IOException
    {
       context.getResponseWriter().endElement(getContainerElementName());
    }
 
-   protected String generateLabel(InputContainerElements elements, FacesContext context)
+   protected String generateLabel(final InputContainerElements elements, final FacesContext context)
    {
       String name = getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX) ? elements.getPropertyName(context) : getId();
       return name.substring(0, 1).toUpperCase() + name.substring(1);
@@ -264,18 +273,20 @@
    /**
     * Walk the component tree branch built by the composite component and locate
     * the input container elements.
-    *
+    * 
     * @return a composite object of the input container elements
     */
-   protected InputContainerElements scan(UIComponent component, InputContainerElements elements, FacesContext context)
+   protected InputContainerElements scan(final UIComponent component, InputContainerElements elements, final FacesContext context)
    {
-      if (elements == null) {
+      if (elements == null)
+      {
          elements = new InputContainerElements();
       }
 
-      // NOTE we need to walk the tree ignoring rendered attribute because it's condition
+      // NOTE we need to walk the tree ignoring rendered attribute because it's
+      // condition
       // could be based on what we discover
-      if (elements.getLabel() == null && component instanceof HtmlOutputLabel)
+      if ((elements.getLabel() == null) && (component instanceof HtmlOutputLabel))
       {
          elements.setLabel((HtmlOutputLabel) component);
       }
@@ -297,7 +308,7 @@
    }
 
    // assigning ids seems to break form submissions, but I don't know why
-   public void assignIds(InputContainerElements elements, FacesContext context)
+   public void assignIds(final InputContainerElements elements, final FacesContext context)
    {
       boolean refreshIds = false;
       if (getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
@@ -312,7 +323,8 @@
          {
             label.setId(getDefaultLabelId());
          }
-         else if (refreshIds) {
+         else if (refreshIds)
+         {
             label.setId(label.getId());
          }
       }
@@ -323,7 +335,8 @@
          {
             input.setId(getDefaultInputId() + (i == 0 ? "" : (i + 1)));
          }
-         else if (refreshIds) {
+         else if (refreshIds)
+         {
             input.setId(input.getId());
          }
       }
@@ -334,7 +347,8 @@
          {
             msg.setId(getDefaultMessageId() + (i == 0 ? "" : (i + 1)));
          }
-         else if (refreshIds) {
+         else if (refreshIds)
+         {
             msg.setId(msg.getId());
          }
       }
@@ -343,17 +357,19 @@
    /**
     * Wire the label and messages to the input(s)
     */
-   protected void wire(InputContainerElements elements, FacesContext context)
+   protected void wire(final InputContainerElements elements, final FacesContext context)
    {
       elements.wire(context);
    }
 
    /**
-    * Get the default Bean Validation Validator to read the contraints for a property.
+    * Get the default Bean Validation Validator to read the contraints for a
+    * property.
     */
-   private Validator getDefaultValidator(FacesContext context) throws FacesException
+   private Validator getDefaultValidator(final FacesContext context) throws FacesException
    {
-      if (!beanValidationPresent) {
+      if (!beanValidationPresent)
+      {
          return null;
       }
 
@@ -378,7 +394,7 @@
       return validatorFactory.getValidator();
    }
 
-   private boolean isClassPresent(String fqcn)
+   private boolean isClassPresent(final String fqcn)
    {
       try
       {
@@ -405,8 +421,8 @@
    {
       private String propertyName;
       private HtmlOutputLabel label;
-      private List<EditableValueHolder> inputs = new ArrayList<EditableValueHolder>();
-      private List<UIMessage> messages = new ArrayList<UIMessage>();
+      private final List<EditableValueHolder> inputs = new ArrayList<EditableValueHolder>();
+      private final List<UIMessage> messages = new ArrayList<UIMessage>();
       private boolean validationError = false;
       private boolean requiredInput = false;
 
@@ -415,7 +431,7 @@
          return label;
       }
 
-      public void setLabel(HtmlOutputLabel label)
+      public void setLabel(final HtmlOutputLabel label)
       {
          this.label = label;
       }
@@ -425,7 +441,7 @@
          return inputs;
       }
 
-      public void registerInput(EditableValueHolder input, Validator validator, FacesContext context)
+      public void registerInput(final EditableValueHolder input, final Validator validator, final FacesContext context)
       {
          inputs.add(input);
          if (input.isRequired() || isRequiredByConstraint(input, validator, context))
@@ -456,7 +472,7 @@
          return messages;
       }
 
-      public void registerMessage(UIMessage message)
+      public void registerMessage(final UIMessage message)
       {
          messages.add(message);
       }
@@ -471,34 +487,36 @@
          return requiredInput;
       }
 
-      private boolean isRequiredByConstraint(EditableValueHolder input, Validator validator, FacesContext context)
+      private boolean isRequiredByConstraint(final EditableValueHolder input, final Validator validator, final FacesContext context)
       {
-         if (validator == null) {
+         if (validator == null)
+         {
             return false;
          }
 
-         // NOTE believe it or not, getValueReference on ValueExpression is broken, so we have to do it ourselves
-         ValueReference vref = new ValueExpressionAnalyzer(((UIComponent) input).getValueExpression("value"))
-               .getValueReference(context.getELContext());
-         return validator.getConstraintsForClass(vref.getBase().getClass())
-               .getConstraintsForProperty((String) vref.getProperty()).hasConstraints();
+         // NOTE believe it or not, getValueReference on ValueExpression is
+         // broken, so we have to do it ourselves
+         ValueReference vref = new ValueExpressionAnalyzer(((UIComponent) input).getValueExpression("value")).getValueReference(context.getELContext());
+         return validator.getConstraintsForClass(vref.getBase().getClass()).getConstraintsForProperty((String) vref.getProperty()).hasConstraints();
       }
 
-      public String getPropertyName(FacesContext context) {
-         if (propertyName != null) {
+      public String getPropertyName(final FacesContext context)
+      {
+         if (propertyName != null)
+         {
             return propertyName;
          }
 
-         if (inputs.size() == 0) {
+         if (inputs.size() == 0)
+         {
             return null;
          }
 
-         propertyName = (String) new ValueExpressionAnalyzer(((UIComponent) inputs.get(0)).getValueExpression("value"))
-               .getValueReference(context.getELContext()).getProperty();
+         propertyName = (String) new ValueExpressionAnalyzer(((UIComponent) inputs.get(0)).getValueExpression("value")).getValueReference(context.getELContext()).getProperty();
          return propertyName;
       }
 
-      public void wire(FacesContext context)
+      public void wire(final FacesContext context)
       {
          int numInputs = inputs.size();
          if (numInputs > 0)

Modified: modules/faces/trunk/docs/reference/src/main/docbook/en-US/installation.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/installation.xml	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/installation.xml	2010-06-02 19:59:00 UTC (rev 12992)
@@ -9,7 +9,7 @@
 		following dependency to your pom.xml file:
 	</para>
 	<programlisting role="XML"><![CDATA[<dependency>
-	<groupId>org.jboss.seam</groupId>
+	<groupId>org.jboss.seam.faces</groupId>
 	<artifactId>seam-faces</artifactId>
 	<version>${seam-faces-version}</version>
 </dependency>]]></programlisting>	

Modified: modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/master.xml	2010-06-02 19:59:00 UTC (rev 12992)
@@ -11,6 +11,7 @@
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="installation.xml" />
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="events.xml" />
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="scopes.xml" />
+   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="messages.xml" />
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="artifacts.xml" />
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="components.xml" />
 

Added: modules/faces/trunk/docs/reference/src/main/docbook/en-US/messages.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/messages.xml	                        (rev 0)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/messages.xml	2010-06-02 19:59:00 UTC (rev 12992)
@@ -0,0 +1,78 @@
+<?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="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>
+ at 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>
+			Adds the message: "This is an INFO message, and will be displayed to the user." 
+		</para>
+		<para>		
+			Notice how {0}, {1} ... {N} are replaced with the given parameters, and may be used more than once in a given template. In the case where a
+			<literal>BundleKey</literal> is used to look up a message template, default text may be provided in case the resource cannot be loaded; default
+			text uses the same parameters supplied for the bundle template. If no default text is supplied, a String representation of the 
+			<literal>BundleKey</literal> and its parameters will be displayed instead.
+<programlisting>
+   public String action()
+   {
+      messages.warn(new BundleKey("org.jboss.seam.faces.exampleBundle", "messageKey"), "unique");
+      return null;
+   }</programlisting>
+	   </para>
+	   <para>
+classpath:/org/jboss/seam/faces/exampleBundle.properties
+<programlisting>messageKey=This {0} parameter is not so {0}, see?</programlisting>
+   			Adds the message: "This unique parameter is not so unique, see?"
+		</para>
+	</section>
+	<section id="displaying">
+		<title>Displaying pending messages</title>
+		<para>
+			It's great when messages are added to the internal buffer, but it doesn't do much good unless the user actually sees them. In order to display
+			messages, simply use the <literal>&lt;h:messages /&gt;</literal> tag from JSF. Any pending messages will be displayed on the page just like normal
+			<literal>FacesMessages</literal>.
+		</para>
+				<programlisting role="XML"><![CDATA[<html xmlns="http://www.w3.org/1999/xhtml"
+   xmlns:f="http://java.sun.com/jsf/core"
+   xmlns:h="http://java.sun.com/jsf/html"
+   xmlns:s="http://jboss.org/seam/faces"
+   xmlns:ui="http://java.sun.com/jsf/facelets">
+      
+   <h1>Welcome to Seam Faces!</h1>
+   <p>All Messages and FacesMessages will be displayed below:</p>
+
+   <h:messages />
+      
+</html>]]></programlisting>
+		<para>
+			Messages added to the internal buffer via the Messages API are stored in a central location during each request, and may be displayed
+			by any view-technology that supports the Messages API. Seam Faces provides an integration that makes all of this automatic for you as a developer,
+			and in addition, messages will automatically survive JSF navigation and redirects, as long as the redirect URL was encoded using 
+			<literal>ExternalContext.encodeRedirectURL(...)</literal>. If you are using JSF-compliant navigation, all of this is handled for you. 
+		</para>
+	</section>
+</chapter>
\ No newline at end of file

Modified: modules/faces/trunk/docs/reference/src/main/docbook/en-US/scopes.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/scopes.xml	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/scopes.xml	2010-06-02 19:59:00 UTC (rev 12992)
@@ -4,44 +4,58 @@
 <chapter id="scopes">
 	<title>Faces Scoping Support</title>
 	<para>
-		JSF 2.0 introduced the concept of the @ViewScope, and the @FlashScope; however, CDI does not support the non-standard
-		ViewScope by default, and JSF 2.0 did not provide annotations for accessing the FlashScope. The Seam Faces module
-		does both.
+		JSF 2.0 introduced the concept of the @FlashScope and the @ViewScope; however, JSF 2.0 did not provide annotations for accessing the FlashScope,
+		 and CDI does not support the non-standard ViewScope by default. The Seam Faces module does both. Beans stored in the FlashScope will survive
+		 until the next page is rendered, and for the most part, beans stored in the ViewScope will survive as long as a user remains on the
+		 same page.
 	</para>
-	<section id="viewscoped">
-		<title>@ViewScope</title>
+	<section id="flashscoped">
+		<title>@FlashScope</title>
 		<para>
-			To scope a bean to the View, use the <literal>@javax.faces.bean.ViewScoped</literal> annotation. This means that your bean will be stored in the 
-			<literal>javax.faces.component.UIViewRoot</literal> object associated with the view in which it was accessed. Each JSF view (faces-page) will store
-			its own instance of the bean, just like each HttpServletRequest has its own instance of a @RequestScoped bean.
-			<programlisting>@ViewScoped
+			You should think about using the Flash scope if you want to store information that will be relevant to the user even after an action
+			sends them to another view. For instance, when a user submits a form, you may want to invoke JSF navigation and redirect 
+			the user to another page in the site; if you needed to store a message to be displayed when the next page is rendered -but no longer- 
+			you would store that message in the FlashContext. Fortunately, Seam provides FlashScoped messages by default, via the 
+			<link linkend="messages">Seam Messages API</link>. 
+		</para>
+		<para>
+			To scope a bean to the Flash, use the <literal>@javax.faces.bean.FlashScoped</literal> annotation. This means that your bean will be stored in the 
+			<literal>org.jboss.seam.context.FlashContext</literal> until the next page is rendered, at which point the FlashScope will be cleared.
+
+<programlisting>
 public class Bean {
 	// ...
 }</programlisting>
+
 			<caution>
 				<para>
-					@ViewScoped beans are destroyed when the JSF UIViewRoot object is destroyed. This means that the
-					life-span of @ViewScoped beans is dependent on the <literal>javax.faces.STATE_SAVING_METHOD</literal> employed by the application itself.
+					@FlashScoped beans are destroyed when the Flash is cleared. This means that the	life-span of @FlashScoped beans last only until
+					the next Render Response phase is executed.
 				</para>
+				<para>
+					If you want to use the Flash Scope with custom navigation in your application, 
+					be sure to call <literal>ExternalContext.encodeRedirectURL(String url, Map&lt;String, List&lt;String&gt;&gt; queryParams)</literal>
+					on any URL before using it to issue a redirect. This will ensure that the FlashContext ID is properly appended to the URL, enabling
+					the FlashContext to be restored on the subsequent request. This is only necessary if issuing a Servlet Redirect.
+				</para>
 			</caution>
 		</para>
 	</section>
-	<section id="flashscoped">
-		<title>@FlashScope</title>
+	<section id="viewscoped">
+		<title>@ViewScope</title>
 		<para>
-			To scope a bean to the Flash, use the <literal>@javax.faces.bean.FlashScoped</literal> annotation. This means that your bean will be stored in the 
-			<literal>javax.faces.context.Flash</literal>; however, the Flash is independent of the JSF view, and independent of the Request object. Objects stored in the
-			Flash will survive one page request, then be destroyed after processing of the next subsequent request. As such, the Flash scope
-			can be thought of as a scope that spans two requests; objects are added to the Flash during the first request, then removed from
-			the Flash and destroyed after the second request.
-			<programlisting>@FlashScoped
+			To scope a bean to the View, use the <literal>@javax.faces.bean.ViewScoped</literal> annotation. This means that your bean will be stored in the 
+			<literal>javax.faces.component.UIViewRoot</literal> object associated with the view in which it was accessed. Each JSF view (faces-page) will store
+			its own instance of the bean, just like each HttpServletRequest has its own instance of a @RequestScoped bean.
+			<programlisting>@ViewScoped
 public class Bean {
 	// ...
 }</programlisting>
 			<caution>
 				<para>
-					@FlashScoped beans are destroyed when the Flash is cleared. This means that the
-					life-span of @FlashScoped beans is limited to two HTTP requests.
+					@ViewScoped beans are destroyed when the JSF UIViewRoot object is destroyed. This means that the
+					life-span of @ViewScoped beans is dependent on the <literal>javax.faces.STATE_SAVING_METHOD</literal> employed by the application itself,
+					but in general one can assume that the bean will live as long as the user remains on the same page.
 				</para>
 			</caution>
 		</para>

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamExternalContext.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamExternalContext.java	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamExternalContext.java	2010-06-02 19:59:00 UTC (rev 12992)
@@ -6,6 +6,7 @@
 import java.util.Map;
 
 import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Typed;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.ExternalContextWrapper;
 import javax.inject.Inject;
@@ -13,6 +14,7 @@
 import org.jboss.seam.faces.context.FlashContext;
 import org.jboss.seam.faces.context.FlashScopedContext;
 
+ at Typed(SeamExternalContext.class)
 @RequestScoped
 public class SeamExternalContext extends ExternalContextWrapper
 {

Modified: modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml	2010-06-02 19:59:00 UTC (rev 12992)
@@ -9,10 +9,8 @@
 	<ordering>
 		<after>
 			<name>weld</name>
-		</after>
-		<before>
 			<others/>
-		</before>
+		</after>
 	</ordering>
 
 	<lifecycle>

Modified: modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml	2010-06-02 19:57:31 UTC (rev 12991)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml	2010-06-02 19:59:00 UTC (rev 12992)
@@ -37,5 +37,6 @@
          <component-type>org.jboss.seam.faces.ValidateForm</component-type>
       </component>
    </tag>
+   <!-- org.jboss.seam.faces.InputContainer is a composite component, does not need taglib -->
 
 </facelet-taglib>
\ No newline at end of file



More information about the seam-commits mailing list