Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 46711 invoked from network); 8 Apr 2010 13:17:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Apr 2010 13:17:02 -0000 Received: (qmail 97070 invoked by uid 500); 8 Apr 2010 13:17:01 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 97012 invoked by uid 500); 8 Apr 2010 13:17:01 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 97005 invoked by uid 99); 8 Apr 2010 13:17:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Apr 2010 13:17:01 +0000 X-ASF-Spam-Status: No, hits=-1359.1 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Apr 2010 13:17:00 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5B65F234C48D for ; Thu, 8 Apr 2010 13:16:40 +0000 (UTC) Message-ID: <1674591538.11061270732600372.JavaMail.jira@brutus.apache.org> Date: Thu, 8 Apr 2010 13:16:40 +0000 (UTC) From: "Jakob Korherr (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Commented: (MYFACES-2645) The view state is saved before encodeAll() is called on every UIViewParameter in an AJAX request In-Reply-To: <462199677.9921270560993492.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MYFACES-2645?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12= 854926#action_12854926 ]=20 Jakob Korherr commented on MYFACES-2645: ---------------------------------------- Hi Leo, To your examples: I tested it with render=3D"@all" and also with execute=3D= "@all", but it didn't work. And if you understand the background, you will = know why it can't work that way. To your question: Basically yes, but in the case of UIViewParameter it aims= to store the value in the state. You see, UIViewParameter takes the value = of a URL parameter as input, but this value is only available for the first= (GET) request. Every following postback won't include the value as a reque= st parameter. Thus we need some way to keep the value from the first reques= t in the state and the spec tells us to use the submittedValue here. Using = the submittedValue to store the original value in the state has one advanta= ge and one disadvantage. The advantage is that in the following request we = just have to ignore a null-value (don't invoke setSubmittedValue(null)) in = decode() and we will get our old submittedValue from the state. The disadva= ntage, however, is that we have to set the submittedValue before the state = is generated, because after the conversions and validations have happend, t= he submittedValue is set to null by the JSF-lifecycle. To accomplish this, = the spec tells us to invoke setSubmittedValue(getStringValue(...)) in UIVie= wParameter.encodeAll() and furthermore to invoke encodeAll() on every UIVie= wParameter in the view in UIViewRoot.encodeEnd(), which works perfectly for= normal requests. For AJAX-requests, however, the state is generated before= UIViewRoot.encodeEnd() is invoked and so the changes of the submittedValue= of every UIViewParameter are lost. Thus I applied the code from UIViewRoot= .encodeEnd() to PartialViewContextImpl.processPartialRendering() before the= state of an AJAX-request is generated to have the changes of the submitted= Value available in the AJAX-state. So you see my committed code is absolutely correct and should not be revert= ed. I guess it was just not thought about the correct handling of UIViewPar= ameters in AJAX-requests when this part of the spec and the javadoc were wr= itten. However I wrote an email to jsr-314-open about this, because I think there = is a better way to solve the problem (see the patch), but we can't apply th= is code now, because it breaks the spec. > The view state is saved before encodeAll() is called on every UIViewParam= eter in an AJAX request > -------------------------------------------------------------------------= ----------------------- > > Key: MYFACES-2645 > URL: https://issues.apache.org/jira/browse/MYFACES-2645 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-314 > Affects Versions: 2.0.0-beta-3 > Reporter: Jakob Korherr > Assignee: Jakob Korherr > Attachments: MYFACES-2645-spec-proposal.patch > > > UIViewParameter calls setSubmittedValue() in encodeAll() to store the cur= rent value of the view parameter in the state as the submitted value (this = helps UIViewParameter to restore its value on a postback). UIViewParameter.= encodeAll() itself is called by UIViewRoot.encodeEnd() for every UIViewPara= meter in the view. > If the current request is an ajax-request, the view state is currently al= ready generated in UIViewRoot.encodeChildren() (before UIViewRoot.encodeEnd= ()). At this time the submitted value for every UIViewParameter is null, be= cause its encodeAll()-method was not called yet. > Later, when UIViewRoot.encodeEnd() is called, UIViewParameter.encodeAll()= is called and it sets the submitted value correctly, but due to the fact t= hat the state has already been generated, these changes are dropped. > This causes the value of every UIViewParameter to be set to null in the n= ext request, which will most likely end in validation problems with the req= uired validator. > The related thread to this issue from the mailing list can be found at: h= ttp://www.junlu.com/list/43/611590.html --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.