You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2015/09/30 01:26:56 UTC

svn commit: r1705950 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java

Author: lu4242
Date: Tue Sep 29 23:26:56 2015
New Revision: 1705950

URL: http://svn.apache.org/viewvc?rev=1705950&view=rev
Log:
MYFACES-3983 ViewScopeBinding does not work, results in an exception when using a datatable

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java?rev=1705950&r1=1705949&r2=1705950&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java Tue Sep 29 23:26:56 2015
@@ -44,6 +44,7 @@ import javax.faces.component.visit.Visit
 import javax.faces.component.visit.VisitHint;
 import javax.faces.component.visit.VisitResult;
 import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
 import javax.faces.validator.BeanValidator;
 import javax.faces.validator.Validator;
 import javax.faces.view.EditableValueHolderAttachedObjectHandler;
@@ -517,6 +518,22 @@ public class ComponentTagHandlerDelegate
         if (_delegate.getBinding() != null)
         {
             ValueExpression ve = _delegate.getBinding().getValueExpression(ctx, Object.class);
+            if (PhaseId.RESTORE_VIEW.equals(faces.getCurrentPhaseId()))
+            {
+                if (!ve.isReadOnly(faces.getELContext()))
+                {
+                    try
+                    {
+                        // force reset it is an easy and cheap way to allow "binding" attribute to work on 
+                        // view scope beans or flow scope beans (using a transient variable)
+                        ve.setValue(faces.getELContext(), null);
+                    }
+                    catch (Exception e)
+                    {
+                        // ignore
+                    }
+                }
+            }
             if (this._rendererType == null)
             {
                 c = app.createComponent(ve, faces, this._componentType);