Author: craigmcc
Date: Sun Aug 28 15:49:53 2005
New Revision: 263929

URL: http://svn.apache.org/viewcvs?rev=263929&view=rev
Log:
Make the managed bean naming requirement for ViewController beans much more
explict, and add exampes of proper mapping for typical cases using the
default mapping implementation (DefaultViewControllerMapper).

Modified:
    
struts/shale/trunk/core-library/src/java/org/apache/shale/view/ViewController.java
    
struts/shale/trunk/core-library/src/java/org/apache/shale/view/impl/DefaultViewControllerMapper.java

Modified: 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/ViewController.java
URL: 
http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/view/ViewController.java?rev=263929&r1=263928&r2=263929&view=diff
==============================================================================
--- 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/ViewController.java
 (original)
+++ 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/ViewController.java
 Sun Aug 28 15:49:53 2005
@@ -16,6 +16,8 @@
 
 package org.apache.shale.view;
 
+import org.apache.shale.view.impl.DefaultViewControllerMapper;
+
 /**
  * <p>[EMAIL PROTECTED] ViewController} is a "backing bean" interface which 
adds several
  * extension points to the standard JavaServer Faces lifecycle. The extension
@@ -56,19 +58,28 @@
  *     constructor in your ViewController backing bean implementation class.
  *     Configuration of ViewController beans is performed using setter 
injection,
  *     rather than through "rich" constructors.</li>
- * <li>Register this class as a JSF <code>&lt;managed-bean&gt;</code>,
- *     using a <code>&lt;managed-bean-name&gt;</code> that corresponds to
- *     the <code>view identifier</code> of the JSF view.  Mapping between
- *     <code>view id</code> and managed bean names will be performed by
- *     a [EMAIL PROTECTED] ViewControllerMapper} configured for this 
application.
- *     <ul>
- *     <li>Under nearly all circumstances, you will want to register this
- *         managed bean to be stored in request scope, so that its lifetime
- *         matches the corresponding view.</li>
- *     <li>Optionally, you may use <code>&lt;managed-property&gt;</code>
- *         elements within the <code>&lt;managed-bean&gt;</code> element
- *         to configure the behavior of your ViewController bean.</li>
- *     </ul></li>
+ * <li>In order for Shale to properly locate the [EMAIL PROTECTED] 
ViewController} for
+ *     a particular JSF view, you must register your implementation class in
+ *     a JSF <code>&lt;managed-bean&gt;</code> element, using a
+ *     <code>&lt;managed-bean-name&gt;</code> value that can be <em>mapped</em>
+ *     from the view identifier.  The actual mapping is performed by an 
instance
+ *     of [EMAIL PROTECTED] ViewControllerMapper} configured for your 
application.  If no
+ *     special configuration is done, [EMAIL PROTECTED] 
DefaultViewControllerMapper} is
+ *     used by default.  See the Javadocs for that class to see what mapping
+ *     rules are applied, and examples of correct managed bean names that
+ *     correspond to particular JSF view identifiers.
+ *     <blockquote>
+ *         <strong>WARNING</strong> - if your managed bean name does not match
+ *         the required mapping rules, it will function as a standard JSF 
backing
+ *         bean, but none of the extra [EMAIL PROTECTED] ViewController} event 
handling
+ *         methods will be called.
+ *     </blockquote></li>
+ * <li>Under nearly all circumstances, you will want to register this
+ *     managed bean to be stored in request scope, so that its lifetime
+ *     matches the corresponding view.</li>
+ * <li>Optionally, you may use <code>&lt;managed-property&gt;</code>
+ *     elements within the <code>&lt;managed-bean&gt;</code> element
+ *     to configure the behavior of your ViewController bean.</li>
  * </ul>
  *
  * <p>Since the ViewController is a backing bean, you have the option of

Modified: 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/impl/DefaultViewControllerMapper.java
URL: 
http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/view/impl/DefaultViewControllerMapper.java?rev=263929&r1=263928&r2=263929&view=diff
==============================================================================
--- 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/impl/DefaultViewControllerMapper.java
 (original)
+++ 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/impl/DefaultViewControllerMapper.java
 Sun Aug 28 15:49:53 2005
@@ -34,6 +34,21 @@
  *     underscore character ("_"), to avoid problems loading managed 
beans.</li>
  * </ul>
  *
+ * <p>Examples of correct managed bean names for typical JSF view identifiers,
+ * when this mapper is used, would include:</p>
+ * <ul>
+ * <li>For a view identifier <code>/mainmenu.jsp</code>, your managed bean
+ *     name <em>must</em> be <code>mainmenu</code> (leading slash and
+ *     trailing extension were stripped).</li>
+ * <li>For a view identifier <code>/customer/details.jsp</code>, your managed
+ *     bean name <em>must</em> be <code>customer$details</code> (intermediate
+ *     slash character also converted).</li>
+ * <li>For a view identifier <code>/header.jsp</code>, your managed bean
+ *     name <em>must</em> be <code>_header</code> ("header" is a magic JSF
+ *     variable returning a Map of HTTP headers for the current request, so
+ *     you cannot use this name for your own managed beans).</li>
+ * </ul>
+ *
  * $Id$
  */
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to