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

Werner Punz edited comment on MYFACES-2762 at 6/20/10 9:05 AM:
---------------------------------------------------------------

Ok we have a bug hear, the fixup code which should fix the viewstate issue does 
not seem to work in this case...
I want to determine first the reason why the code fails before checking the 
patch.

Btw. just a short note, this is not a new bug by the javascripts, in fact the 
new javascrips try to deal with that condition. If it worked in 2.0 then the 
behavior of the server response has changed.

I want to give an example here: the Example introduces following response:

<?xml version="1.0" encoding="utf-8"?><partial-response><changes><update 
id="javax.faces.ViewRoot"><![CDATA[<body><form id="form1" name="form1" 
method="post" action="/TestScripts/componentTest2.jsf" 
enctype="application/x-www-form-urlencoded"><input type="hidden" 
name="form1_SUBMIT" value="1" /></form><form id="form2" name="form2" 
method="post" action="/TestScripts/componentTest2.jsf" 
enctype="application/x-www-form-urlencoded"><script type="text/javascript" 
src="/TestScripts/javax.faces.resource/jsf.js.jsf?ln=javax.faces&amp;stage=Development"><!--

//--></script><input id="form2:j_id534375431_1fd9ec85" 
name="form2:j_id534375431_1fd9ec85" type="submit" value="AJAX Submit" 
onclick="jsf.util.chain(document.getElementById('form2:j_id534375431_1fd9ec85'),
 
event,'jsf.ajax.request(\'form2:j_id534375431_1fd9ec85\',event,{render:\'@all\',\'javax.faces.behavior.event\':\'action\'})');
 return false;" /><input type="hidden" name="form2_SUBMIT" value="1" 
/></form>true</body>]]></update><update 
id="javax.faces.ViewState"><![CDATA[MKC2SZhkiN/Kh5FJcY/Aui965FVp0LNTHxYuNNIPS8gYrCxYqtW2wy6gWCpUXxtKADMc+H7PlY5/
GKHmzOOSL+Vxi7SiyEx92fNJFHXPxcj6GiTpiCMvEL7VtYy2YefTDgPmaA==
]]></update></changes></partial-response>

As you can see both forms are rendered without a viewstate element and the 
viewstate is appended afterwards with the javax.faces.ViewState.
Now here things become difficult. The spec states that the viewState only can 
be attached to the issuing form. Which is the fault I sent to the spec issue 
tracker, but in fact all forms within the render or update cycle should have a 
reattached viewstate.

Now things become even more difficult, because the old codebase did not even 
have this fixup code, so I assume the rendering behavior must have been 
different with the viewstate being embedded in 2.0.

(Btw. my testing revealed mojarra also does not deal with this problem in a 
proper manner, they also have some fixup code but it also fails in certain 
conditions)

In either way, the fixup code did not work out properly which I added in 2.0.1 
to deal with exactly this issue. I missed your case, I will first check why it 
fails, and then later check your patch to get to a correct solution there.


      was (Author: werpu):
    Ok we have a bug hear, the fixup code which should fix the viewstate issue 
does not seem to work in this case...
I want to determine first the reason why the code fails before checking the 
patch.

  
> 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