[ 
https://issues.apache.org/jira/browse/MYFACES-2762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880634#action_12880634
 ] 

Werner Punz commented on MYFACES-2762:
--------------------------------------

Ok now to the patch, most of it definitely looks correct, the viewstate has to 
be applied to all forms which have changes (also even outer forms) elements so 
applying it only to elements which have a form embedded like I did before is 
not entirely correct, in fact the change trace should step up until the parent 
form if it does not embed one or more forms.

secondly:
 if (!document.forms || !document.forms.length) {
             return null;
-        } else if (1 == document.forms.length) {
-            return document.forms[0];
         }
+        // This will not work well on portlet case, because we cannot be sure
+        // the returned form is right one. 
+        //else if (1 == document.forms.length) {
+        //    return document.forms[0];
+        //}
         if (!elem) {
             return null;
         }

This is only a fallback routine in case of an element cannot be traced back to 
an original form, so your fix here, does not really solve a lot of things 
because a cross portlet submit is not possible and we cannot issue a submit 
unless we have a form issuing it.

As for the rest of the changes they make a lot of sense although I would not 
use two data structures for the change trace, I would push it into one list.


One minor gripe, call me nitpicky, the last change to the delete, but I do not 
want to have direct dom manipulating routines in the response, everything dom 
manipulating has to go through dom hence I will rework the last change. This 
costs a little bit of performance, but I prefer a structured separation of 
concerns to the last inch of performance. So I will not really use that change.

Nevertheless I will apply all of the patches and rework from there a little 
bit, thanks a lot you saved me a load of work here, you really  found a huge 
issue here and also added code from the portlet case handling.


> Handling mutiple h:form and AJAX is broken
> ------------------------------------------
>
>                 Key: MYFACES-2762
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2762
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.1-SNAPSHOT
>         Environment: myfaces current trunk (19.6.2010)
>            Reporter: Martin Kočí
>            Priority: Critical
>         Attachments: MYFACES-2762.patch
>
>
> Is seems that handling of 
> http://www.mail-archive.com/[email protected]/msg00043.html 
> (https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=790) 
> is broken in current trunk. This example:
>         <h:form id="form1">
>         </h:form>
>         
>         <h:form id="form2">
>             <h:commandButton value="AJAX Submit">
>                 <f:ajax render="@all" />
>                 <f:setPropertyActionListener value="#{true}" 
> target="#{viewScope.test}" />
>             </h:commandButton>
>         </h:form>
>         <h:outputText value="#{viewScope.test}" />
> should produce output "true" with all clicks but it works only at first. 
> Firebug shows that all javax.faces.ViewState elements are removed after first 
> response. If I comment out first h:form it works as expected.
> Because this example works fine with 2.0.0 I think it a regression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to