How can I save a configuration locally and permanently in a Java Applet? Ideally this should be work with a not signed Applet.
In addition to AlexR's methods..
- ..
- ..
- Run the applet in a new generation Java plug-in (1.6.0_10+) and use the JNLP API's PersistenceService to serialize the data. Here is a demo. of the PersistenceService.
Applet may receive parameters using <param>
tag. This way you can send it parameters you know at design time or at runtime.
If you mean that user that uses the applet can change some parameters and you wish to store them you have 2 possibilities.
- Store them in cookies by invoking javascript using JSObject.
- Store them on server side. Applet may send the parameters to server using any kind of network connection for example using web service (e.g. RestFull web service). Server stores the configuration and sends it to applet as parameters (using
<param>
tags) that are generated by JSP. Alternatively applet may retrieve parameters using same web service it used to store them on startup.
来源:https://stackoverflow.com/questions/4803001/how-to-save-some-config-information-in-an-java-applet