users@glassfish.java.net

Re: how to store json data in browser

From: <glassfish_at_javadesktop.org>
Date: Fri, 04 Apr 2008 03:57:10 PST

You can store session data on the client side in cookies. Cookies do consume bandwidth as they are sent back and forth to the server, and if the session objects are large (over ~4k) can fail outright. (If the json you are storing is likely to be smaller than this then I would use cookies - the performance hit will likely be unnoticable. If you are worried about this then try benchmarking it before jumping to conclusions.)

If the amount of data really is large, I would suggest creating an ajax application where there is no page reload for as long as the data is needed (And hence no data loss).

Other solutions could include use of frames (Where data is stored in a parent frame and the application is opened in a child frame, with the data is accessed from the document.parent node. The disadvantage to this approach is you lose your url, and would have to do some special coding to get bookmarkability (Like using in page links - like GWT.) This approach would probably suck from the point of view of SEO.

Hope this helped

Tofarr
[Message sent by forum member 'tofarr' (tofarr)]

http://forums.java.net/jive/thread.jspa?messageID=267717