myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1705950 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
Date Tue, 29 Sep 2015 23:26:56 GMT
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);



Mime
View raw message