Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Creating Applet reading/writing to file

Thread view: 
michael.rygh@gmail.com - 12 Dec 2005 16:56 GMT
I'm pretty sure you can do this but for my final project I'm gonna make
an applet thats like a quiz thing and I want the persons final results
to be saved to a file. so then next time someone plays, the high scores
can be read from the file and they can see how they rate againts other
people.

Just making sure.. is this something that can be done using an applet
or do I have to do something special? thanks for the help!
Rhino - 12 Dec 2005 17:12 GMT
> I'm pretty sure you can do this but for my final project I'm gonna make
> an applet thats like a quiz thing and I want the persons final results
[quoted text clipped - 4 lines]
> Just making sure.. is this something that can be done using an applet
> or do I have to do something special? thanks for the help!

Roedy Green has some very useful articles about applets at his site; you
should definitely look at them, particularly this article to start:
http://mindprod.com/jgloss/applet.html. Pay special attention to the section
on Unsigned Applet Restrictions. Now, this may tempt you to write a signed
applet but don't make that decision until you investigate all the
rigamarole - and possible expense - involved in creating a signed applet at
http://mindprod.com/jgloss/signedApplets.html.

You may want to rethink your project and make it a servlet or JSP, rather
than an applet. In any case, you should be well aware of the implications if
you decide to go with an applet before you invest any significant time in an
applet solution.

Rhino
Oliver Wong - 12 Dec 2005 20:00 GMT
> I'm pretty sure you can do this but for my final project I'm gonna make
> an applet thats like a quiz thing and I want the persons final results
[quoted text clipped - 4 lines]
> Just making sure.. is this something that can be done using an applet
> or do I have to do something special? thanks for the help!

   If you convert your Applet to an Application, and then deploy it with
Java Web Start, then it's "almost as easy", for the client's point of view,
to run as an Applet, and you yet you can take advantage of "Services"
provided by the JNLP:

http://java.sun.com/developer/technicalArticles/Programming/jnlp/

Note the "DownloadService" which can be used to cache local resources, and
the "FileSaveService". All of this while avoiding the hassles involved in
signing an Applet.

   - Oliver
Andrew Thompson - 16 Dec 2005 08:51 GMT
....
>     If you convert your Applet to an Application, and then deploy it with
> Java Web Start, then it's "almost as easy", for the client's point of view,
> to run as an Applet, and you yet you can take advantage of "Services"
> provided by the JNLP:

If you JWS an applet you can also access the same services..

> Note the "DownloadService" which can be used to cache local resources, and
> the "FileSaveService". All of this while avoiding the hassles involved in
> signing an Applet.

[ ..but I see no point for this to be an applet, in any case. ]

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Oliver Wong - 16 Dec 2005 20:21 GMT
> ....
>>     If you convert your Applet to an Application, and then deploy it with
[quoted text clipped - 3 lines]
>
> If you JWS an applet you can also access the same services..

   My understanding was that if you use JWS with an applet, you had to sign
the applet, and so the user would have to say whether or not (s)he trusts
the signature. Trusting the signature in this situation gives full control
to applet, creating an "all or nothing" situation.

   In contrast, using JWS with an application, you can request specific
services, and JWS would tell the user WHICH services were being requested,
so that the user could give the application only partial control over the
system.

   But this is only from reading (somewhat vague) documentation, and I
haven't actually tested this in code, so I may be wrong.

   - Oliver
Andrew Thompson - 16 Dec 2005 23:30 GMT
>     My understanding was that if you use JWS with an applet, you had to sign
> the applet,

Nope.  <http://www.physci.org/pc/jtest-applet.jnlp>
I definitely did not sign that.

>...and so the user would have to say whether or not (s)he trusts
> the signature. Trusting the signature in this situation gives full control
> to applet, creating an "all or nothing" situation.

Same applies to JWS'd applets and applications, they either request
all-permissions or none - there is nothing in between.

>     In contrast, using JWS with an application, you can request specific
> services, and JWS would tell the user WHICH services were being requested,
> so that the user could give the application only partial control over the
> system.

Nope, see above.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Andrew Thompson - 17 Dec 2005 00:25 GMT
(Oliver W.)
>>     In contrast, using JWS with an application, you can request
>> specific services, and JWS would tell the user WHICH services were
>> being requested, so that the user could give the application only
>> partial control over the system.
>
> Nope, see above.

When you throw permissions set in 'policy files' into the mix,
your comments make more sense.

People may have been used to allowing applets (or applications)
particular permissions via the policy files, whereas JWS is 'all
or nothing'.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Malte - 12 Dec 2005 20:06 GMT
> I'm pretty sure you can do this but for my final project I'm gonna make
> an applet thats like a quiz thing and I want the persons final results
[quoted text clipped - 4 lines]
> Just making sure.. is this something that can be done using an applet
> or do I have to do something special? thanks for the help!

Having the applet communicate with the server is no problem. If nothing
else, you can use http tunneling and write to a file or a database on
the server.
Roedy Green - 12 Dec 2005 21:22 GMT
>Just making sure.. is this something that can be done using an applet
>or do I have to do something special? thanks for the help!

There are two basic approaches.

1. you save to a local file. This requires a signed applet.  The
Applet then sees the scores only of people that played on that
machine.

2. you save the data to a server. This requires writing some server
side code, e.g. a Servlet.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.