• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Saving state in an applet

 
Ranch Hand
Posts: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to be able to save the current game (of chess) in my applet but I'm not sure on the easiest way. I could communicate to a database but this seems like overkill. I could call a local web page that perhaps stores the game but again this looks quite difficult.

Is there an easy way of writing a string (about 300 char length) to the browser and letting it return it when that user next goes to the page. Any ideas?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the various *Stream* methods in AppletContext. I've heard people report mixed successes with this, though.
 
Ranch Hand
Posts: 77
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mich Robinson wrote:I'd like to be able to save the current game (of chess) in my applet but I'm not sure on the easiest way. ..

Is there an easy way of writing a string (about 300 char length) to the browser and letting it return it when that user next goes to the page. Any ideas?



  • If the user's browser is running a Plug-In2 Architecture JRE, use the PersistenceService of the JNLP API.
  • Earlier JREs might store a cookie with the help of JS.
  • HTML 5 offers Local Storage.
  • A trusted applet can store the settings on the local file system.
  •  
    Mich Robinson
    Ranch Hand
    Posts: 287
    2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Are these techniques common?
    ie would most browsers support them?
    What happens if they're not supported?

    PS I don't have any control over user's browsers.
     
    Andrew Thompson
    Ranch Hand
    Posts: 77
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mich Robinson wrote:Are these techniques common?
    ie would most browsers support them?
    What happens if they're not supported? ..



    The answer to each question is 'it depends on the technique you are referring to'. I am not about to write a treaties covering all possibilities. Be more specific and put some research in, before I'll offer any more.

    Mich Robinson wrote:..PS I don't have any control over user's browsers.



    And that is a good thing. If web/server side developers start thinking they have any right or power to control the user or their browser, things go down hill rapidly.
    reply
      Bookmark Topic Watch Topic
    • New Topic