myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Müllan" <bierbra...@gmail.com>
Subject Re: s:inputSuggestAjax - how this tag works with database values
Date Mon, 02 Jul 2007 10:14:35 GMT
Hi,

the expected behaviour should be completely done in the
suggestedItemsMethod. So it is
the developers responsibility to return the list from the db-call, in
your case getAssetMgmtSystems(). The call to well fitting suggestions
must occur there.

cheers,

Gerald

On 7/2/07, bansi <mail2bansi@yahoo.com> wrote:
>
> I am using Facelets 1.1.2 Tomahawk Sandbox 1.1.5 . The s:inputSuggestAjax
> component example as mentioned in MyFaces wiki works perfectly fine for me.
> When i tried using it against the values retrieved from Database, it appends
> the prefix to the values from database.
>
> For example if i key in "A" in the textbox , then suggested words shows all
> the database values appended with A .
>
>
>
> i.e. AWashington
>
>       ANewYork
>
>       ANew Jersey
>
>
>
> The expected behaviour is it should only those values from Database which
> starts with A or starts with any character that is keyed into textbox
>
>
>
> Here is the snippet
>
> JSF page:
>
> <h:outputText value="Enter your state : "/>
>
>
> <s:inputSuggestAjax suggestedItemsMethod="#{test.getSuggestedWords}"
> value="#{test.currentValue}" />
>
>
>
> Backing Bean:
>
> public List doGetStateList(String keyword){
>
>
>
> List stateList = new ArrayList();
>
> List<AssetMgmtSystem> assetMgmtSystem = new ArrayList<AssetMgmtSystem>();
>
> assetMgmtSystem = deviceManager.getAssetMgmtSystems(); // calls database to
> retrieve  state List
>
>
>
> for (int i=0; i< assetMgmtSystem.size(); i++) {
>
> AssetMgmtSystem asset = (AssetMgmtSystem) assetMgmtSystem.get(i);
>
> Long assetId = asset.getId();
>
> String assetName = asset.getName();
>
> keyword = assetName.substring(0,1);
>
> stateList.add(keyword + assetName);
>
> }
>
> return stateList;
>
>
>
> }
>
>
>
> Any pointers/suggestions will be highly appreciated
>
>
>
> Regards
>
> Bansi
>
>
> --
> View this message in context: http://www.nabble.com/s%3AinputSuggestAjax---how-this-tag-works-with-database-values-tf4009641.html#a11387032
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message