On 11/01/2011 11:50 PM, Waqas Sadiq wrote: > Hi, > > I am working on storing different user counters in memory at > application level (not database) and to have counters to atmost 3. > > I developed this code using a singleton class with hashmap to store a > key value pair of user id and and it's counter and time. > > After initial, i was using this singleton class on client side, it > worked fine for counters but when browser was refreshed, a new > singleton object was created. > > I searched, and come to know that for security reason, javascript > don't use shared objects, so i moved it to rpc call and make it server > side object to overcome it, but when i tested it again, on refresh new > object is created and data lost.
That's expected behavior. You'll want to retrieve the stored data at application startup. > I also tested the static hashmap to hold the data for application > scope, but it has almost the same behavior, once refreshed the > browser, its reset and old data is lost in it. It little different > behavior from normal java web apps where we follow this approach. > > Does any one know how can i keep object at application scope in gwt ? Can you restrict your app to browsers that support local storage? In no way will the static storage class solve the problem you're describing. -- 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.
