This notebook is a collection of code snippets and technical "how to" instructions.
Search This Blog
Using java.util.Properties in Servlet to save User Preferences
by: Uki D. Lucasimport java.util.Properties;
String propertiesFileName = "my_properties.txt";
SAVE PREFERENCES:
Properties unsavedProperties = new Properties();
unsavedProperties.setProperty("my_name", "Uki");
OutputStream propOut = new FileOutputStream(new File(propertiesFileName));
unsavedProperties.store(propOut, "My Server properties");
LATER READ THE SAVED PREFERENCES:
InputStream inStream = new FileInputStream(propertiesFileName);
Properties savedPropeties = new Properties();
savedPropeties.load(inStream);
String myName = savedPropeties.getProperty("my_name");
Subscribe to:
Posts (Atom)