Applets and Persistence


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 12 of 12

Thread: Applets and Persistence

  1. #1
    Join Date
    Oct 2005
    Posts
    8

    Angry Applets and Persistence

    I'm pretty apalled at how badly Java stuff is documented on the web.

    I have tried for hours to get detailed information on EXACTLY what I can and cannot do so far as using persistence from within Java applets.

    It seems from what little scraps of info I can find on various websites that there is precious little available.

    I thought that AppletContext and setStream/getStream were going to do the job, but alas no.

    It seems that all I can hope for is for data to be "persisted" inside a JVM instance and not the machine the user is using!!!

    This really is not persistence as it only stores data in volatile storage, it should be called "caching" or something.

    Every time I try to get serious with Java or Java applet techbnology I am confronted by poor or vague documentation.

    There is NO detailed explanataion of exactly what the AppletContext persistence support actually does, and as always I am forced to guess and scrounge the web.

    If anyone knows how I can get applet code to store/retrieve data to/from the disk system so that applets may store user entered data across logins, I will be very very grateful!

    Thanks
    Hugh

  2. #2
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    >store/retrieve data to/from the disk system
    Applets are not normally given permission to read/write the local disk system. To get permission they must either be signed or have entries in the local system's java.policy file.
    You probably want to store data on the server.

  3. #3
    Join Date
    Oct 2005
    Posts
    8

    Unhappy

    Well we are trying to identify options for building functionality that cannot assume a server even exists (there may be no network).

    We want an app that can run on MacOS, Linux, Windows (ie a web browser based app).

    It also needs to persist thousands of answers to questions, and using cookies is proiving too risky because user can delete cookies at any time.

    I wanted to create app using DHTML and Java applet technology intermixed.

    I am surprised that there is no support for the AppletContext persistence model to be extended to the file system, it is such a handicap.

    Thanks anyway

  4. #4
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    You are trying to use a mechanism in a manner for which it was not intended. The whole applet technology was built for running remotely, on a client machine, in a browser, a program downloaded from the server which would not give the program access to any of the resources on the client and limited access to the resources on the server. This is all about security. [This may explain why you are having such difficulty finding information ... I have found that Java is an EXTENSIVELY documented language - if you are asking the right questions as you look for something which it can allow you to do.]

    Have you looked at technologies such as Java Server Pages, Java Server Faces, javabeans, and other such "JEEE" toys? It sounds to me that these are more fitting for the program you want to deliver.

  5. #5
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    I don't understand why you're looking at applets if your not using a network.
    Why not an ordinary, standalone app such as you run from a jar file?

  6. #6
    Join Date
    Oct 2005
    Posts
    8
    Actually we are just looking at options.

    We have been considering using the "Portable Firefox" as a way to host some basic functionality, this would allow us to distribute the "application" on CD to our subscribers and have it run on any platform that support portable firefox.

    If user has net access, fine we can do various things, if they dont well we can run but not provide some features.

    We do need to record their answers to questions, in an ongoing manner (ie they can come back over days and weeks and aaccumulate their answerrs) and one that doesnt use cookies (in case the delete cookies in some cleanup operation !).


    Maybee your right, and just creating a GUI Java app is best, what tools would you recommend for this, for creating/debugging/testing java applications (GUI and not applets) ?

    Borland? Sun? IBM ????

    Thks

  7. #7
    Join Date
    Oct 2005
    Posts
    8
    Additionally, is it possible in Java to "host" a "broswer control" ?

    It would be most attractive technically, if we could engineer a pure Java app that was also able to render content, including XML (much of our data is XML).

    Now in an MS environment I can simply drag/drop an IE Browser control on a form and hey-presto I can (in essence) programmatically drive my own browser.

    Is such a thing do-able in a Java world???

    Thks
    Hugh

  8. #8
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Hugh:

    The whole Swing/AWT GUI interface is, in effect, a "browser window" to your program. It gives you the graphical elements, input/output, and access to the capabilities you are probably associating with a "browser window".

    I use Netbeans, which incorporates JUnit testing. You can create tests which include the GUI elements ... Implementation of GUI with "automatic code generation" included ... even better now with the Netbeans 5.0 beta ...

    Yes, you can build a "browser" with all the bells and whistles you want - either with native Java library classes and methods, or those provided by the many people who help out the whole community by building components and functionality.
    Last edited by nspils; 10-05-2005 at 01:23 PM.

  9. #9
    Join Date
    Oct 2005
    Posts
    8
    Well I dont want to build a browser, but want to be able to render data in HTML and XML with CSS etc.

    In other words I weant to be able to display a window that acts like a browser and "knows" how to do these things.

    Like I was saying there is a pre-built browser control in Windows that I can simply add to a Form and "hey presto" I can send HTML data to it.

    Is there no equivalent GUI control/widget supported in Java ??

    H

  10. #10
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Java empowers you to build such a "browser", yourself.

    You can rely on the work of others, such as JRex (but the site says you cannot run an applet in this browser on Windows):

    http://jrex.mozdev.org/index.html

  11. #11
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    A project I just wrote used a localhost server. I wanted to provide access locally to html files I had downloaded from various websites using a browser. The app and all the html files are loaded into a jar. When the app starts, it starts a server and loads the default browser with a URL pointing to the local server. After that the user interface is via his browser. Requested pages are loaded from the jar or created as needed. As needed I added features to the server.

  12. #12
    Join Date
    Oct 2005
    Posts
    1

    Post

    Quote Originally Posted by Guvnor
    Well I dont want to build a browser, but want to be able to render data in HTML and XML with CSS etc.

    In other words I weant to be able to display a window that acts like a browser and "knows" how to do these things.

    Like I was saying there is a pre-built browser control in Windows that I can simply add to a Form and "hey presto" I can send HTML data to it.

    Is there no equivalent GUI control/widget supported in Java ??

    H

    Use Html coding

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center