Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 82314 invoked from network); 30 Oct 2006 21:33:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2006 21:33:09 -0000 Received: (qmail 59256 invoked by uid 500); 30 Oct 2006 21:33:15 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 59220 invoked by uid 500); 30 Oct 2006 21:33:15 -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 59209 invoked by uid 99); 30 Oct 2006 21:33:15 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Oct 2006 13:33:15 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of mwessendorf@gmail.com designates 66.249.92.173 as permitted sender) Received: from [66.249.92.173] (HELO ug-out-1314.google.com) (66.249.92.173) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Oct 2006 13:33:01 -0800 Received: by ug-out-1314.google.com with SMTP id j3so1179854ugf for ; Mon, 30 Oct 2006 13:32:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Z+TR7bTNzvMRGItskKPENfuk2Y2ykvEVtztP3XJqy6DrkVmUjFu7FvbpLuQT2SAgrAIkTqRhttTeK+an2DEtTQrFI7OfYblgBZvnrBxJhGeO4Hw2YOpkZ9JqOJ+sBkyipc8WpQcx7RW+7DLaTOsCIS58C+e+aNWceeXsDxlMXOg= Received: by 10.67.117.2 with SMTP id u2mr4876218ugm; Mon, 30 Oct 2006 13:32:36 -0800 (PST) Received: by 10.66.240.4 with HTTP; Mon, 30 Oct 2006 13:32:36 -0800 (PST) Message-ID: <71235db40610301332x4d2a0275y592c06347916d5c0@mail.gmail.com> Date: Mon, 30 Oct 2006 13:32:36 -0800 From: "Matthias Wessendorf" Sender: mwessendorf@gmail.com To: "MyFaces Discussion" Subject: Re: InputSuggestAjax and binding In-Reply-To: <311295120610301327j7082a8a1u732f51c083ab45ce@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1162203222.2907.2.camel@localhost> <311295120610300450u7fdf0c4fq5a3486aedf30587e@mail.gmail.com> <1162218017.2907.25.camel@localhost> <311295120610300707w7e5f4071od5d7986b37dff357@mail.gmail.com> <1162240133.2907.98.camel@localhost> <311295120610301327j7082a8a1u732f51c083ab45ce@mail.gmail.com> X-Google-Sender-Auth: 94983e68d9226a2d X-Virus-Checked: Checked by ClamAV on apache.org suggestedItems !=3D getSuggestedItems perhaps that is the deal. it is method binding so when using "suggestedItems" in the EL name the method suggestedItems when using getSuggestedItems in EL name is getSuggestedItems -M On 10/30/06, Gerald M=FCllan wrote: > You have to provide exactly the same method name, so in your case it > is getSuggestedItems. If you use the maxSuggestedItems approach, you > also have to give the method an Integer on the way home. > > So: > > public List getSuggestedItems(String prefix, Integer maxSize) > { > .. > } > > If it still doesn`t work, please post the stack trace here. You can > also have a look at the sandbox examples, where invoking the method > works without any problems. > > regards, > > Gerald > > On 10/30/06, Martin Grotzke wrote: > > On Mon, 2006-10-30 at 16:07 +0100, Gerald M=FCllan wrote: > > > Well, the component doesn`t work like this. > > > > > > The suggestedItemsMethod takes a String which was the input of the > > > user before the ajax-request. With the help of this string the lookup > > > in the db is performed and the result as > > > a list of strings is returned. Which exactly matches the pop-up. > > Okay. I changed the backing bean so that it provides a method that > > takes a string and returns a list of strings. > > > > Unfortunately, no method is invoked. > > > > The tag looks like the following: > > > > > suggestedItemsMethod=3D"#{createReservationController.departure= .suggest2.suggestedItems}" > > value=3D"#{createReservationController.departure.suggest2.selec= tedItem}" > > maxSuggestedItems=3D"10" /> > > > > But on the createReservationController backing bean the getDeparture > > method is never called. > > > > Do you have any tips what's causing this? > > The same value expression (ok, nearly the same) works for anther field, > > so the expression itself is correct. > > > > Thanx && cheers, > > Martin > > > > > > > > > > If you want to get a behaviour like it can be found in menues with th= e > > > value/label approach, > > > you have to define a "itemLabelMethod". The suggestedItemsMethod > > > should then return a list of objects. The label is extracted through > > > the itemLabelMethod (which gets an object from the list) and the valu= e > > > through a given converter. > > > > > > Hope this helps, > > > > > > cheers, > > > > > > Gerald > > > > > > On 10/30/06, Martin Grotzke wrote: > > > > On Mon, 2006-10-30 at 13:50 +0100, Gerald M=FCllan wrote: > > > > > Hi, > > > > > > > > > > forget the binding stuff. It is not needed. The docu on this comp= onent > > > > > is outdated. > > > > Thanx for this hint :) > > > > > > > > > > > > > > All you need to do to get it work in the simplest mode is just > > > > > implement the suggestedItemsMethod. > > > > But probably i can use the valueChangeListener to fetch the items > > > > that are returned by suggestedItemsMethod? > > > > > > > > I just tried the component with the following sniplet: > > > > > > > > > > > suggestedItemsMethod=3D"#{createReservationController.departure= .suggest.items}" > > > > value=3D"#{createReservationController.departure.suggest.userIn= put}" > > > > valueChangeListener=3D"#{createReservationController.departure.= suggest.userInputChanged}" > > > > maxSuggestedItems=3D"10" size=3D"10" > > > > tabindex=3D"2" /> > > > > > > > > and the following on the server side: > > > > > > > > public void userInputChanged( ValueChangeEvent event ) { > > > > LOG.debug( "Invoked" ); > > > > // performs a lookup in the backend > > > > // and updates the suggested items: > > > > suggestItems( true ); > > > > } > > > > > > > > public Collection getItems() { > > > > return _items; > > > > } > > > > > > > > public String getUserInput() { > > > > return _userInput; > > > > } > > > > > > > > public void setUserInput( String input ) { > > > > _userInput =3D input; > > > > } > > > > > > > > > > > > Unfortunately, the java code is never called, even the > > > > createReservationController.getDeparture is not called.... > > > > > > > > Can you tell me what is wrong with this? > > > > We are using the nightly snapshot (today) of myfaces-api/impl, toma= hawk > > > > and the sandbox. > > > > > > > > Thanx && cheers, > > > > Martin > > > > > > > > > > > > > > > > > > Sorry for the confusion on this. > > > > > > > > > > cheers, > > > > > > > > > > Gerald > > > > > > > > > > On 10/30/06, Martin Grotzke wrote: > > > > > > Hey all, > > > > > > > > > > > > the documentation for inputSuggestAjax > > > > > > (http://myfaces.apache.org/sandbox/inputSuggestAjax.html) says = that > > > > > > the binding attribute "is needed because the control object doe= s all the > > > > > > needed data transformation between the Ajax control and the > > > > > > backend/frontend"... > > > > > > > > > > > > Has someone an example how to implement the binding on the serv= er side? > > > > > > > > > > > > Thanx a lot, > > > > > > cheers, > > > > > > Martin > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Martin Grotzke > > > > http://www.javakaffee.de/blog/ > > > > > > > > > > > > > > > > > > > > -- > > Martin Grotzke > > http://www.javakaffee.de/blog/ > > > > > > > > > -- > http://www.irian.at > > Your JSF powerhouse - > JSF Consulting, Development and > Courses in English and German > > Professional Support for Apache MyFaces > --=20 Matthias Wessendorf http://tinyurl.com/fmywh further stuff: blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com