Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes GWT and the fly likes Populate Dropdowns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Populate Dropdowns" Watch "Populate Dropdowns" New topic
Author

Populate Dropdowns

rudreshashok kumar
Greenhorn

Joined: Aug 27, 2006
Posts: 16
Hi All,

I am trying to populate a dropdown from database using rpc (Async). The problem is the page gets download and dropdown does not get populated, but it has the values.

I believe the approach that i took is incorrect, it should not be Async, but again i did not find any other way to call the service from gwt client

Can someone helpme on this

Thanks
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10491
    
    9

The problem is the page gets download and dropdown does not get populated, but it has the values.

This is a little bit of contradictory as well as confusing.
Could you please explain what you mean by
1) page gets downloaded (Downloaded as on to the disk?)
2) dropdown does not get populated, but it has the values


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
rudreshashok kumar
Greenhorn

Joined: Aug 27, 2006
Posts: 16
1) page gets downloaded (Downloaded as on to the disk?)
I meant the Page is rendered with empty dropdown values
I had put a debug point on the service layer, that gets called after the page is rendered.

2) dropdown does not get populated, but it has the values
I meant that dropdown does not get populated

I a gist i have a simple html and in the onmoduleLoad method i am trying to populate a dropdown, for now let us say it is Male/Female. This value is a reference data and that comes from database.
I have written a service(ServiceImpl) would query database and result the arrayList, this is been called from gwt client through rpc

ServiceAsync serviceAsync = GWT.create(Service.class)

String[] str = null;
serviceAsync.getMasterData(new AsyncCallback<String[]>()) {

OnFailure{}
OnSuccess (String[] result){
str =result
}

//now populate dropdown.

Some how i felt this will work for onclick events but not onload as this is asynchronous call and will not wait and proceed with executing onmoduleload method

Hope this clarifies

Thanks

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10491
    
    9


Where do you populate the list box? You need to double check you are populating the one which you have added to your code and not creating a new one.

Some how i felt this will work for onclick events but not onload as this is asynchronous call and will not wait and proceed with executing onmoduleload method

Did you try it out? What happened?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populate Dropdowns