Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 32570 invoked from network); 12 Aug 2005 15:59:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Aug 2005 15:59:05 -0000 Received: (qmail 79898 invoked by uid 500); 12 Aug 2005 15:59:02 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 79866 invoked by uid 500); 12 Aug 2005 15:59:01 -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 79853 invoked by uid 99); 12 Aug 2005 15:59:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2005 08:59:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gthought@gmail.com designates 64.233.184.206 as permitted sender) Received: from [64.233.184.206] (HELO wproxy.gmail.com) (64.233.184.206) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2005 08:59:21 -0700 Received: by wproxy.gmail.com with SMTP id i17so669123wra for ; Fri, 12 Aug 2005 08:58:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=aLgOUinx8o3h331kcPxt9wZV5qWWi3OSXmobcdOh/bbt+ujQUzn4qdKir7SuY0pXiC3MHRsKYFx0feuUBgQ9kFUBeB/J5hJurdddZe3nKzGFomj6VqfCEpd5rtdVmONoFpYnWkXWA5/aNphcu9aEOcPvNXQvgJDYJrzVy+a4hpc= Received: by 10.54.2.61 with SMTP id 61mr1968108wrb; Fri, 12 Aug 2005 08:58:58 -0700 (PDT) Received: by 10.54.81.9 with HTTP; Fri, 12 Aug 2005 08:58:58 -0700 (PDT) Message-ID: Date: Fri, 12 Aug 2005 10:58:58 -0500 From: Gregg D Bolinger To: MyFaces Discussion , martin@marinschek.com Subject: Re: method binding not working correctly In-Reply-To: <5a99335f050812084834903d2e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42FC5651.101@psi.de> <42FCAAA0.6010707@psi.de> <8f985b9605081208283d187bbf@mail.gmail.com> <5a99335f0508120847484333f5@mail.gmail.com> <5a99335f050812084834903d2e@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Ok, here is a reply to all: What happens if you use an h:commandButton instead? - Doesn't matter What happens if you dump the render statement? - Then the update method is called just fine Is "#{not categoryAdmin.updateMode}" legal? I've always used ! to this point - yes, this is legal. is your method signature correct? - Yes, I am importing the correct class try to use an action instead of an action listener - is this called? - I get the same results with this. The update method is not called. Thanks for all the suggestions guys. Gregg On 8/12/05, Martin Marinschek wrote: > another thing: try to use an action instead of an action listener - is > this called? >=20 > regards, >=20 > Martin >=20 > On 8/12/05, Martin Marinschek wrote: > > wild shot: is your method signature correct? > > > > Particularly, are you importing javax.faces.ActionEvent and not > > java.awt.ActionEvent? IntelliJ always shows the latter one first when > > doing code complete, easy to slip to the wrong import. > > > > regards, > > > > Martin > > > > On 8/12/05, Gregg D Bolinger wrote: > > > No problem. Here it is. > > > > > > <%@ taglib uri=3D"http://java.sun.com/jsf/html" prefix=3D"h"%> > > > <%@ taglib uri=3D"http://java.sun.com/jsf/core" prefix=3D"f"%> > > > <%@ taglib uri=3D"http://myfaces.apache.org/extensions" prefix=3D"x"%= > > > > > > > > > > Simple jsp page > > > > > > > > > > > > > > actionListener=3D"#{categoryAdmin.edit}" value=3D"Edit" rendered=3D"#= {not > > > categoryAdmin.updateMode}" /> > > > > > actionListener=3D"#{categoryAdmin.update}" value=3D"Update" > > > rendered=3D"#{categoryAdmin.updateMode}"/> > > > > > > > > > > > > > > > > > > > > > public class CategoryAdmin extends BaseBean { > > > > > > private boolean updateMode =3D false; > > > > > > public boolean isUpdateMode() { > > > return updateMode; > > > } > > > > > > public void setUpdateMode(boolean updateMode) { > > > this.updateMode =3D updateMode; > > > } > > > > > > public void edit(ActionEvent event){ > > > > > > System.out.println("Edit"); > > > setUpdateMode(true); > > > } > > > > > > public void update(ActionEvent event){ > > > System.out.println("Updating"); > > > } > > > } > > > > > > > > > > > > > > > On 8/12/05, Mike Kienenberger wrote: > > > > If you post your stripped-down example + the method itself (maybe > > > > there's a typo there), we'll probably be better able to suggest > > > > something. > > > > > > > > On 8/12/05, Gregg D Bolinger wrote: > > > > > If I strip the page down to only include the 2 buttons (no datata= ble > > > > > or any other components on the page), I get the same result. > > > > > > > > > > Gregg > > > > > > > > > > On 8/12/05, Gregg D Bolinger wrote: > > > > > > The dataTable's data is fine. Why would that make a difference= though? > > > > > > > > > > > > On 8/12/05, Mathias Broekelmann wrote: > > > > > > > Is it possible that the returned list for the datatable conta= ins no > > > > > > > values in the decode phase? > > > > > > > > > > > > > > Regards, > > > > > > > Mathias > > > > > > > > > > > > > > Gregg D Bolinger schrieb: > > > > > > > > As I stated in my first post, it doesn't matter if it is in= request or > > > > > > > > session. I get the same results. saveState didn't solve t= he problem > > > > > > > > and rendered=3D"#{categoryAdmin.updateMode}" does resolve t= o true after > > > > > > > > the Edit button is pressed. That was clear in my code I po= sted. > > > > > > > > > > > > > > > > Any other ideas? > > > > > > > > > > > > > > > > Gregg > > > > > > > > > > > > > > > > On 8/12/05, Mathias Broekelmann wrote= : > > > > > > > > > > > > > > > >>take a look at rendered=3D"#{categoryAdmin.updateMode}" whi= ch must be true > > > > > > > >>to process the actionlistener when the request is decoded. = Save the > > > > > > > >>state of categoryAdmin with t:savestate or make the bean se= ssion scope. > > > > > > > >> > > > > > > > >>Hope that helps. > > > > > > > >> > > > > > > > >>Regards, > > > > > > > >>Mathias > > > > > > > >> > > > > > > > >>Gregg D Bolinger schrieb: > > > > > > > >> > > > > > > > >>>FYI - the missing # from the actionListener in > > > > > > > >>> > > > > > > > >>> > > > > > > >>>actionListener=3D"{categoryAdmin.update}" value=3D"Update" > > > > > > > >>>rendered=3D"#{categoryAdmin.updateMode}"/> > > > > > > > >>> > > > > > > > >>>was corrected as I was typing in a hurry. The problem stil= l persists. > > > > > > > >>>Thanks for any help. And I am using MyFaces 1.0.9. Using= the latest > > > > > > > >>>nightly snapshot did not resolve this issue either. > > > > > > > >>> > > > > > > > >>>Gregg > > > > > > > >>> > > > > > > > >>>On 8/11/05, Gregg D Bolinger wrote: > > > > > > > >>> > > > > > > > >>> > > > > > > > >>>>I'm not sure if this is an issue with MyFaces or with how= I am doing > > > > > > > >>>>what I am doing or what. I have a very simple page with = a a > > > > > > > >>>>dataTable. I am wanting to edit the data in the dataTabl= e inline. > > > > > > > >>>>That is to say, not navigating to a seperate page. I hav= e it setup > > > > > > > >>>>with an edit button for each item and when that button is= pressed I > > > > > > > >>>>render inputText components and an update button for the = associated > > > > > > > >>>>row. This works. > > > > > > > >>>> > > > > > > > >>>>The problem is that the update button's actionListener me= thod binding > > > > > > > >>>>isn't working. When I press the update button, nothing h= appens. The > > > > > > > >>>>update(ActionEvent event) method is never called. It doe= sn't matter > > > > > > > >>>>if the bean is in the session or request. It just doesn't= call the > > > > > > > >>>>method. I have stripped the code down to the simplest wo= rking example > > > > > > > >>>>that demonstrates this problem which I will post below. = As it is > > > > > > > >>>>right now, I am merely showing and hiding the update/edit= buttons. > > > > > > > >>>>When I press Edit the edit method is being called and the= update > > > > > > > >>>>button is rendered where the edit button is now not rende= red. If I > > > > > > > >>>>hit update button, the update method is never called and = the edit > > > > > > > >>>>button is displayed again, hiding the update button. I r= ealize that > > > > > > > >>>>with each button press a new request is being sent to the= server. > > > > > > > >>>>However, it JSF is supposed to save the state of the bean= for > > > > > > > >>>>actionListeners since it does not navigate from the page.= However, I > > > > > > > >>>>don't believe this is working correctly. Any ideas? Tha= nks. > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> Simple jsp page > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > >>>>value=3D"#{categoryAdmin.categoryList}" border=3D"1" > > > > > > > >>>>forceIdIndex=3D"#{cat.categoryId}" > > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > >>>>actionListener=3D"#{categoryAdmin.edit}" value=3D"Edit" r= endered=3D"#{not > > > > > > > >>>>categoryAdmin.updateMode}" /> > > > > > > > >>>> > > > > > > >>>>actionListener=3D"{categoryAdmin.update}" value=3D"Update= " > > > > > > > >>>>rendered=3D"#{categoryAdmin.updateMode}"/> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > >>>>value=3D"Delete"/> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>>
> > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > >>>>value=3D"Cance"/> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>>
> > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>>
> > > > > > > >>>> > > > > > > > >>>>public class CategoryAdmin extends BaseBean implements Se= rializable { > > > > > > > >>>> > > > > > > > >>>> private List categoryList; > > > > > > > >>>> private UIData categoryData; > > > > > > > >>>> private boolean updateMode =3D false; > > > > > > > >>>> > > > > > > > >>>> private Category category; > > > > > > > >>>> > > > > > > > >>>> public List getCategoryList() { > > > > > > > >>>> CategoryService catService =3D > > > > > > > >>>>(CategoryService)getAppContext().getBean("categoryService= "); > > > > > > > >>>> categoryList =3D catService.getall(); > > > > > > > >>>> return categoryList; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void setCategoryList(List categoryList) { > > > > > > > >>>> > > > > > > > >>>> this.categoryList =3D categoryList; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public UIData getCategoryData() { > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> return categoryData; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> public void setCategoryData(UIData categoryData) { > > > > > > > >>>> this.categoryData =3D categoryData; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public boolean isUpdateMode() { > > > > > > > >>>> return updateMode; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void setUpdateMode(boolean updateMode) { > > > > > > > >>>> this.updateMode =3D updateMode; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public Category getCategory() { > > > > > > > >>>> if (category =3D=3D null){ > > > > > > > >>>> category =3D new Category(); > > > > > > > >>>> } > > > > > > > >>>> return category; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void setCategory(Category category) { > > > > > > > >>>> this.category =3D category; > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void edit(ActionEvent event){ > > > > > > > >>>> System.out.println("Edit"); > > > > > > > >>>> category =3D (Category)categoryData.getRowData(); > > > > > > > >>>> category.setEditable(true); > > > > > > > >>>> setUpdateMode(true); > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void update(ActionEvent event){ > > > > > > > >>>> System.out.println("Updating"); > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> public void delete(ActionEvent event){ > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> CategoryService catService =3D > > > > > > > >>>>(CategoryService)getAppContext().getBean("categoryService= "); > > > > > > > >>>> Category cat =3D (Category)categoryData.getRowData= (); > > > > > > > >>>> catService.delete(cat); > > > > > > > >>>> setCategoryList(catService.getall()); > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void add(ActionEvent event){ > > > > > > > >>>> System.out.println("Adding"); > > > > > > > >>>> > > > > > > > >>>> CategoryService catService =3D > > > > > > > >>>>(CategoryService)getAppContext().getBean("categoryService= "); > > > > > > > >>>> catService.insert(getCategory()); > > > > > > > >>>> > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void cancel(ActionEvent event){ > > > > > > > >>>> > > > > > > > >>>> } > > > > > > > >>>> > > > > > > > >>>> public void changeAddMode(ActionEvent event){ > > > > > > > >>>> System.out.println("Changing Add Mode"); > > > > > > > >>>> > > > > > > > >>>> } > > > > > > > >>>>} > > > > > > > >>>> > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > http://www.irian.at > > Your JSF powerhouse - > > JSF Trainings in English and German > > >=20 >=20 > -- >=20 > http://www.irian.at > Your JSF powerhouse - > JSF Trainings in English and German >