aspose file tools*
The moose likes GWT and the fly likes Passing a String[] to EntryPoint class sends a null object! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Passing a String[] to EntryPoint class sends a null object!" Watch "Passing a String[] to EntryPoint class sends a null object!" New topic
Author

Passing a String[] to EntryPoint class sends a null object!

Nipuna Perera
Greenhorn

Joined: Aug 19, 2008
Posts: 7
I am using GWT 2.0.3 and smartGWT 2.2. I don't think this is a smartGWT specific problem its a GWT question. I am working on a building a GWT front end to a simple database. I have successfully made a datagrid and imported data from an MySQL database to a DataGrid item. I am using an extra class to do the AsyncCallBack and get the data. It works perfectly for one class. I need to populate a combo box and I created another class. Heres the code..



In the class which has the onModuleLoad() method (entry point class) I am initializing the above class and using the getDesigns() method to get the data but the getDesigns ALWAYS returns a null object. I am utterly confused as to why.. I am doing the same thing on another class from which im getting all the other data from my database to populate the DataGrid and it works. There I am creating a DataSource and adding records to it and then using a getDataSource() method exactly like the above class, im importing the data to the entrypoint class. I can't understand why i cant pass a string array. Any help would be great!! Thanks!!
>


SCJP 5.0
Francois Nadeau
Ranch Hand

Joined: Apr 09, 2009
Posts: 46
Hello Nipuna,

I assume that you already solved this, but I figure I can always respond anyway.

You did not provide the code where you use the DesignsAndCriteria class, but I am assuming that you it looks like this:



The problem with that is that initializeDesignsArray calls a synchronous function. Therefore, there are no guaranties that the designs variable is set when you call the getDesigns function.

There are many ways to solve this problem, one that comes to mind by looking at your code is the following:



and then change your code calling DesignsAndCriteria:


This will basically delay your initilization code until you have recieved the data from the synchronous call.

Hopes this helps,

Cheers.


[url]http://FrancoisNadeau.com[/url]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing a String[] to EntryPoint class sends a null object!