Thank you for your input, what was happening is once the RPC was complete the data that I was adding to the ArrayList would disappear. So I decided to do something ugly, but it works. I am writing the data onto a invisible div on the page then getting it then adding it to the ArrayList. It seems to work just fine.
I am new to GWT but I am starting to get a basic understanding on how these things work. I was wondering if anyone knows of a way to run a function after the RPC is complete. Thanks! John On May 9, 7:44 am, Salvador Diaz <[email protected]> wrote: > Well, the indexOutOfBoundsException can't possibly be thrown by the > method add of an ArrayList (that's the type of productArrayList, isn't > it?). In fact there's nothing in your snippets that'll throw that > exception. Did you debug the method call on the server side ? > Somewhere in your Eclipse or HostedMode console you'll have a complete > stack trace that'll tell you the exact line of code that's throwing > that exception. I suggest you read it carefully. > > As for the lifecycle of your RPCs, it is the normal lifecycle of a > servlet. > > Hope that helps, > > Salvador > > On May 8, 10:46 pm, JohnofLong <[email protected]> wrote: > > > I tried to find this topic already on the discussions but could not > > find it. > > > Currently using GWT 1.5.3 > > > I am making a RPC to call to read XML and call a function that loads > > the data into an ArrayList of classes. I have made a class that > > implements RequestCallback(LoadData) and takes in my mainClass > > example: > > > LoadData loadData = new LoadData(this); > > String url = xmlString; > > RequestBuilder requestBuilder = new RequestBuilder > > (RequestBuilder.GET, url); > > try { > > requestBuilder.sendRequest(null, loadData); > > } catch (RequestException ex) { > > //Window.alert("exception"); > > } > > > Inside the RPC class: > > > mainClass.addProducts(id, sku, name, catagory) ; > > > inside my main class: > > public addProducts(int id, int sku, String name, String catagory) { > > productArrayList.add(new product(id, sku, name, catagory); > > > } > > > But when I call a method on my productArray it just says index out of > > bound (basically the arrayList is empty) but I know it is calling the > > addProduct method > > > I am guessing the lifespan of the data is tied to the lifespan of the > > RPC call. > > > What sort of things can I do to get around this(assuming my > > assumptions are correct)? > > > I greatly appreciate the help and apologize if this topic is covered > > somewhere already. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
