Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 71054 invoked from network); 25 Feb 2007 10:57:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Feb 2007 10:57:48 -0000 Received: (qmail 10638 invoked by uid 500); 25 Feb 2007 10:57:54 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 10594 invoked by uid 500); 25 Feb 2007 10:57:54 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 10583 invoked by uid 99); 25 Feb 2007 10:57:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Feb 2007 02:57:54 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=HTML_00_10,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of joern.zaefferer@googlemail.com designates 64.233.162.230 as permitted sender) Received: from [64.233.162.230] (HELO nz-out-0506.google.com) (64.233.162.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Feb 2007 02:57:43 -0800 Received: by nz-out-0506.google.com with SMTP id n29so438247nzf for ; Sun, 25 Feb 2007 02:57:23 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=jX7pdHoxYNMeB1PcP1jPAw4wjkMio+9M4P649hlOlvMS3zexzzGEULl85WE4gZZmKWQ8WZEXpLCX85havMByqCwzVcCJGgQZQQpjiWJ6/USXn5BJG+UWQyzyUgUXLWwsc4qprRG4p4oFdKt5UY2EzcURPobNJ+OSB6MCIEI5QS8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Sq55cLSVjeBQ0PXXpWgWeJ5XItAQhE/DjL3EUTHR1z9bib69VEhey4YGVW+WLIe2E0znw9XbplvNa8m7l4WjkjVdhu2AqUpgNCFB/8WR/GKze+dqBz+SD4kq0M9GZrfCAgvQhq6aGZ7g3rnVmlIWKVX9IrdQZUqZ6PYujDrUE50= Received: by 10.114.75.1 with SMTP id x1mr1718785waa.1172401042582; Sun, 25 Feb 2007 02:57:22 -0800 (PST) Received: by 10.114.209.3 with HTTP; Sun, 25 Feb 2007 02:57:22 -0800 (PST) Message-ID: <5de41c7d0702250257h5b958a13re0d6ba25d3e4f717@mail.gmail.com> Date: Sun, 25 Feb 2007 11:57:22 +0100 From: "=?ISO-8859-1?Q?J=F6rn_Zaefferer?=" To: users@myfaces.apache.org Subject: Screwed up JSF lifecycle/component tree when using portlet2portlet communication MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_86005_10197980.1172401042512" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_86005_10197980.1172401042512 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi myfacers, I'm working on an application that is running on WebSphere Portal 5.1. I've managed to exchange the IBM/Sun JSF implementation (and portlet bridge) wit= h MyFaces and Facelets, but one particular problem persists, caused by the communication from portlet to portlet. It doesn't even matter if I use IBMs "portlet wiring" (which doesn't work with MyFaces at all) or via the portle= t session in application scope (which is nothing more then the normal HTTPSession). So far IBM couldn't help at all, so maybe there is a MyFaces specific fix for this. Or a generic JSF fix that I don't yet, which is quite likely. Ok, on to the actual problem: 1. I select an item in the first portlet, it is then opened in the second 2. I edit some fields, causing validation errors when pressing Save 3. I select a different item in the first portlet, it is displayed in the second, but the errors are still there 1. Same steps as 1. and 2. above, but now I select Cancel (commandButton with immediate=3D"true") 2. I select a different item in the first portlet, it is displayed in the second, but: Only those fields that were empty after causing the validation error are now filled correctly, other fields still have the old value, though = the underlying object has defnitely the correct data; The old data must come somewhere from the component tree Our attemtps so far to clear the values from the component tree were unsuccesful: I tried creating a new UIViewRoot (copying the RendererType from the old one) and setting it as the new viewroot. A colleague tried to set all submitted values in the tree to null, which didn't help either. As IBMs porlet wiring doesn't work with MyFaces, I describe how I implemented the communication via the application session: 1. The first portlet sets an object to the portlet session in appliction scope in an action listener: public void selectMeeting(ActionEvent e) { DtreeNavEntry entry =3D entry(e); FacesUtil.saveApplicationSessionObject("Meeting", entry); } FacesUtil encapsulates some of the noisy JSF API calls, no magic there 2. The other side is a bit more complicated: 1. There is a PhaseListener registered in the faces-config.xmlcalled PortletLifecycle 2. This class manages a list of PhaseListeners, stored in the PortletSession, therefore each portlet can register one or more PhaseListeners that are only executed for that portlet (at least that is how I'd like it to behave, but that isn't the problem here) 3. The controller used in the second portlet registers a PhaseListener at this PortletLifecycle, adding a callback that is executed before the RENDER_RESPONSE phase 4. The callback checks if there is an object in the portlet session in application scope and if there is any, it removes it 5. If there is an object, it does something with it, displaying the correct view (via fc.getViewRoot().setViewRoot(...) for the type of object (here: meetings, agenda items and activities) Maybe someone on this list had already a similar problem and can provide a hint for a solution. Let me know if it would help to post the code of the controllers and the PortletLifecycle. Any help is highly appreciated, thanks! Regards J=F6rn Zaefferer ------=_Part_86005_10197980.1172401042512 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi myfacers,

I'm working on an application that is running on We= bSphere Portal 5.1. I've managed to exchange the IBM/Sun JSF implementa= tion (and portlet bridge) with MyFaces and Facelets, but one particular pro= blem persists, caused by the communication from portlet to portlet. It does= n't even matter if I use IBMs "portlet wiring" (which doesn&#= 39;t work with MyFaces at all) or via the portlet session in application sc= ope (which is nothing more then the normal HTTPSession).

So far IBM couldn't help at all, so maybe there is a MyFaces sp= ecific fix for this. Or a generic JSF fix that I don't yet, which is qu= ite likely.

Ok, on to the actual problem:
  1. I select an ite= m in the first portlet, it is then opened in the second
  2. I edit some fields, causing validation errors when pressing Save
  3. I select a different item in the first portlet, it is displayed in t= he second, but the errors are still there
  1. Same steps as 1.= and 2. above, but now I select Cancel (commandButton with immediate=3D&quo= t;true")
  2. I select a different item in the first portlet, it is displayed in= the second, but:
    Only those fields that were empty after causing the va= lidation error are now filled correctly, other fields still have the old va= lue, though the underlying object has defnitely the correct data; The old d= ata must come somewhere from the component tree
Our attemtps so far to clear the values from the component tree w= ere unsuccesful: I tried creating a new UIViewRoot (copying the RendererTyp= e from the old one) and setting it as the new viewroot. A colleague tried t= o set all submitted values in the tree to null, which didn't help eithe= r.

As IBMs porlet wiring doesn't work with MyFaces, I describe how= I implemented the communication via the application session:
  1. Th= e first portlet sets an object to the portlet session in appliction scope i= n an action listener:
    public void selectMeeting(ActionEvent e) {
        DtreeN= avEntry entry =3D entry(e);
        FacesUtil.saveApplication= SessionObject("Meeting", entry);
    }
    FacesUtil encapsulates s= ome of the noisy JSF API calls, no magic there
  2. The other side is a bit more complicated:
    1. There is= a PhaseListener registered in the faces-config.xml called PortletLifecycle=
    2. This class manages a list of PhaseListeners, stored in the Portlet= Session, therefore each portlet can register one or more PhaseListeners tha= t are only executed for that portlet (at least that is how I'd like it = to behave, but that isn't the problem here)
    3. The controller used in the second portlet registers a PhaseLis= tener at this PortletLifecycle, adding a callback that is executed before t= he RENDER_RESPONSE phase
    4. The callback checks if there is an object = in the portlet session in application scope and if there is any, it removes= it
    5. If there is an object, it does something with it, displaying the c= orrect view (via fc.getViewRoot().setViewRoot(...) for the type of object (= here: meetings, agenda items and activities)
Maybe someone on= this list had already a similar problem and can provide a hint for a solut= ion. Let me know if it would help to post the code of the controllers and t= he PortletLifecycle.

Any help is highly appreciated, thanks!

Regards
J=F6rn Za= efferer
------=_Part_86005_10197980.1172401042512--